Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Serialisation of dockControl/dockItem layout (Read 1166 times)
MarkAGr
YaBB Newbies
*
Offline


New to it all, really
frustrating at the moment.

Posts: 29
Location: Europe
Joined: Nov 18th, 2017
Serialisation of dockControl/dockItem layout
Aug 21st, 2018 at 11:33pm
Print Post  
I've tried setting up a set of dockItem-s in a dockControl then saving using savetoxml ... fine, I get an xml file

But nothing happens when I try to reload the configuration with loadfromxml.

Can you point me to an example of this working please.

8^)
Mark
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 509
Joined: Jun 17th, 2010
Re: Serialisation of dockControl/dockItem layout
Reply #1 - Aug 23rd, 2018 at 7:29am
Print Post  
Hi,

You will need to handle the DockControl.ItemLoading event, and reload the item's content from there. A working example of this can be downloaded from this link: https://mindfusion.eu/winforms-ui-controls-samples.html - the Dock Control sample.

Code
Select All
void dockControl1_ItemLoading(object sender, ItemEventArgs e)
{
    if (e.Item.Content == null)
    {
        if (e.Item.Id == "TabbedDocument")
            e.Item.Content = GetContent("Tabbed Document");
        // Rest of the items omitted for clarity
    }
}

private Control GetContent(string contentType)
{
    Control control = null;

    // ...

    if (contentType == "Tabbed Document")
    {
        Label label = new Label();
        label.Padding = new Padding(10);
        label.BorderStyle = BorderStyle.None;
        label.Margin = new Padding(0);
        label.Text = "...";
        label.BackColor = Color.White;
        control = label;
    }

    // ...

    return control;
} 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
MarkAGr
YaBB Newbies
*
Offline


New to it all, really
frustrating at the moment.

Posts: 29
Location: Europe
Joined: Nov 18th, 2017
Re: Serialisation of dockControl/dockItem layout
Reply #2 - Aug 24th, 2018 at 8:20am
Print Post  
Great!
Thank You.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint