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);