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);
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));
Ah, thank you for clearing up my confusion. The following code works perfectly for me:
Style content_style = new Style(typeof(ContentPaneProxy)); content_style.Setters.Add(new Setter(ContentPane.HeaderProperty, "Some Header Text")); Style split_pane_style = new Style(typeof(SplitPaneProxy)); split_pane_style.Setters.Add(new Setter(XamDockManagerProxy.InitialLocationProperty, Infragistics.Composite.Wpf.Proxies.Docking.InitialPaneLocation.DockedRight)); XamDockManagerSettings.SetContentPaneProxyStyle((DependencyObject)status_view, content_style); XamDockManagerSettings.SetIsContentPaneInTabGroup((DependencyObject)status_view, false); XamDockManagerSettings.SetSplitPaneName((DependencyObject)status_view, "SomeSplitPaneName"); XamDockManagerSettings.SetSplitPaneProxyStyle((DependencyObject)status_view, split_pane_style); this.mRegionManager.Regions["MainDockingRegion"].Add(status_view, "StatusViewName");