Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
144
Programmatically setting SplitPane's InitialLocation when using NCAL
posted

I'm using DockManager in a Composite WPF application via the NCAL. When one of my my modules loads, I want it to add itself to the DockManager on the right-hand side. I cannot figure out how to do this programmatically.

Using the example code works fine:

   Style content_style = new Style(typeof(ContentPaneProxy));
   content_style.Setters.Add(new Setter(ContentPane.HeaderProperty, "Pane Header"));
  
   XamDockManagerSettings.SetContentPaneProxyStyle((DependencyObject)view_object, content_style);
   XamDockManagerSettings.SetIsContentPaneInTabGroup((DependencyObject)view_object, true);
   XamDockManagerSettings.SetSplitPaneName((DependencyObject)view_object, "SplitPaneName");
  
   this.mRegionManager.Regions["MainRegion"].Add(view_object, "ViewName");

But this causes the new view to be added as a split pane on the left. I want the InitialLocation to be DockedRight.

I tried setting the SplitPaneProxy style, but that didn't work (got an exception, "The 'InitialLocation' property is only intended for SplitPane instances in the Panes collection of the XamDockManager"):
  
   Style split_pane_style = new Style(typeof(SplitPaneProxy));
   split_pane_style.Setters.Add(new Setter(XamDockManager.InitialLocationProperty, Infragistics.Windows.DockManager.InitialPaneLocation.DockedRight));
   XamDockManagerSettings.SetSplitPaneProxyStyle((DependencyObject)view_object, split_pane_style);
  
I also tried calling the SetInitialLocation, which also triggered the same exception:
  
   XamDockManager.SetInitialLocation((DependencyObject)view_object, Infragistics.Windows.DockManager.InitialPaneLocation.DockedRight);

Parents
  • 54937
    Verified Answer
    Offline posted

    mddudley said:
    Style split_pane_style = new Style(typeof(SplitPaneProxy));
       split_pane_style.Setters.Add(new Setter(XamDockManager.InitialLocationProperty, Infragistics.Windows.DockManager.InitialPaneLocation.DockedRight));

    This is correct. You are setting the property on SplitPaneProxy which is a class defined in the NCAL assembly and is not a SplitPane instance.

    mddudley said:
    XamDockManager.SetInitialLocation((DependencyObject)view_object, Infragistics.Windows.DockManager.InitialPaneLocation.DockedRight);

    This too is not a SplitPane but is your usercontrol/view.

    I believe the NCAL library has its own definition of the enumerations so I believe the syntax would be something like: split_pane_style.Setters.Add(new Setter(XamDockManagerProxy.InitialLocationProperty, Infragistics.Composite.Wpf.Proxies.Docking.InitialPaneLocation.DockedRight));

Reply Children
No Data