How to map a UserControl

Jan 5, 2012 at 5:54 PM

Hello all,

    I've just downloaded the avalondock. The demo works fine, and it seems quite simple and performing. I'm using VS2010, NET 4.0 and use  .NET language.

I've created a simple wpf user control (only a label for the moment, but will later have complex controls with data bindings), and I'd like to add it as a dockable content : how to ??

Or maybe my usercontrol should inherit from some class and add the control in a WPF window is sufficient ?

 I'm starting a big application and need these docking functionalities for many screens of it.

Thank you for help,

 

Regards,

Steph.

Jan 10, 2012 at 12:35 PM

Hi Steph,

 

I hope this code will be a good start up.

 

public MainWindow()
        {
            InitializeComponent();
            OnLoad_Window();
            Load_LeftPanel();
	    Load_RightPanel;

        }


private void Load_LeftPanel()
        {

            
            var leftpanel = new DockableContent();
            leftpanel.Title = "Tank Name";
            leftpanel.Name = "ListContent";
            leftpanel.Content = new LeftPanel(); //LeftPanel is my userControl
            leftpanel.IsCloseable = false;
            leftpanel.DockableStyle = DockableStyle.DockableToBorders;
            leftpanel.Width = 350;
            leftpanel.Show(dockManager, AnchorStyle.Left);
            leftpanel.Activate();
            
        }


 private void Load_RightPanel()
        {
            
            var RightPanel = new DocumentContent();
            RightPanel .Title = "RightPanel ";
            RightPanel .Content = new RightPanel(); //RightPanel is my userControl
            RightPanel .Show(dockManager);
            RightPanel .Activate();
        }

 

thanks,

thenndral

 

Jan 10, 2012 at 1:15 PM

Hi Thenndral,

 

Thank you very much for your post, it works fine !!

 

  Regards,

 

Steph.

Jan 11, 2012 at 9:59 AM

Hi Steph,

Glad to help.

Regards,

thenndral.