We are using InfragisticsWPF4 Controls.
Step to Launch the application :
1) Unzip the application.
2) Build the project.
3) Run the application.
4) After successful launch just say File->Open
5) Drag the Status View to bottom of the Tune Data view.
6) Right click on Tab item(Test1) and say floating.
7) Composite views are re-arranged to side by side.
Actual Result : Composite views(Status and Tune Data) are re-arranged side by side.
Expected Result : Composite view should preserve their layouts in docking and floating of the Tab Item.
Problem Description :Dock Manager is not preserving the layouts.
8) We defined the user control(Tabed View) with the following approach for the Docking look using Dock Manager.
<igDock:XamDockManager LayoutMode="FillContainer" Theme="IGTheme">
<igDock:XamDockManager.Panes>
<igDock:SplitPane>
<igDock:TabGroupPane regions:RegionManager.RegionName="TabGroupPaneRegion"
TabStripPlacement="Top"
UseLayoutRounding="True"
VerticalAlignment="Stretch" >
</igDock:TabGroupPane>
</igDock:SplitPane>
</igDock:XamDockManager.Panes>
</igDock:XamDockManager>
9) We have one more control “Composite View” for showing all my views in to this control. We have defined the “Composite View” with following approach.
<igDock:XamDockManager LayoutMode="FillContainer" Theme="IGTheme" Name="dockManager">
<igDock:SplitPane Name="sp" UseLayoutRounding="True">
<igDock:ContentPane Header="TuneData"/>
<igDock:ContentPane Header="Staus Log"/>
10) Adding the Composite View to the Tabbed View control as a Content Pane using TabGroupRegionAdapter(i.e we are setting the Composite View to the ContentPane.Content)
11) After launching the application , I just dragged one of my view(Status Log) to dropped at another view’s(Tune Data) bottom.
12) Right clicked on Tab and say floating, after that my views (Status and Tune Data) are re-arranged side by side.
13) We want to preserve the lay outs of my composite view’s in Tab item docking and floating.
Regards,
Yugandher
Hello Yugandher,
Thank you for your post. I have been looking into it and the sample you have provided and I isolated your scenario in a simple sample without using Prism and everything works as expected on my side, so my suggestion is to check the implementation of Prism.
Hope this helps you.
Hello Steafan,
Thank you for your quick response . It is not problem with Prism . If we add Content Pane's statically every thing works fine .Please find the below code block.
<igDock:XamDockManager LayoutMode="FillContainer" Theme="IGTheme"> <igDock:XamDockManager.Panes> <igDock:SplitPane> <!--<igDock:TabGroupPane regions:RegionManager.RegionName="TabGroupPaneRegion" TabStripPlacement="Top" UseLayoutRounding="True" VerticalAlignment="Stretch" > </igDock:TabGroupPane>--> <igDock:TabGroupPane TabStripPlacement="Top" UseLayoutRounding="True" VerticalAlignment="Stretch" > <igDock:ContentPane Header="Test1"> <igDock:XamDockManager LayoutMode="FillContainer" Theme="IGTheme" Name="dockManager"> <igDock:XamDockManager.Panes> <igDock:SplitPane Name="sp" UseLayoutRounding="True"> <igDock:ContentPane Header="TuneData"/> <igDock:ContentPane Header="Staus Log"/> </igDock:SplitPane> </igDock:XamDockManager.Panes> </igDock:XamDockManager> </igDock:ContentPane> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:XamDockManager.Panes> </igDock:XamDockManager>
In our solution we have used "TabGroupPaneRegionAdapter" to create the Tab Items dynamically . If you try your sample with "TabGroupPaneRegionAdapter" the problem what i have stated will be reproducible . Please do the needful.
Thanks in advance,
Yuagndher
Hello Avnish,
Thank you for your post. I have been looking into it and I can suggest you see the sample in the Samples browser under xamDockManager / Display / Loading and Saving Layouts section, where there is a sample showing how to save/load layouts and everuthing works as you want and the tab placements are persisted.
Hi,
I am also facing a similar issue. the savelayout method of doc manager is not saving the tabstripplacement and the contentpane settings. I modified my xaml code according to the suggestion above but it's still not working. Is there anything else which I need to do. Can somebody help me with this?
<igDock:TabGroupPane TabStripPlacement="Top">
<igDock:ContentPane x:Name="A" AllowClose="False" AllowDockingInTabGroup="True" AllowPinning="False" CloseButtonVisibility="Collapsed" CloseAction="HidePane" Header="View1">
<igDock:ContentPane.Content>
<View:View1 x:Name="View1" DataContext="{Binding View1Vm}">
</View:View1 >
</igDock:ContentPane.Content>
</igDock:ContentPane>
<igDock:ContentPane x:Name="B" Header="View2" AllowClose="False" AllowDockingInTabGroup="True" AllowPinning="False" CloseButtonVisibility="Collapsed" CloseAction="HidePane">
<!--<UserControls:SearchableDatagrid x:Name="stockpositionsgrid" DataContext="{Binding StockPositions}">
</UserControls:SearchableDatagrid>-->
<View:View2 x:Name="View2" DataContext="{Binding View2Vm}">
</View:View2>
Hello,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Indeed, doing what you suggested is working for me.
Thank you ..
I have investigate your sample further for you and I don’t know who wrote TabGroupPaneRegionAdapter but I can say that this is not something that Infragistics has provided. The only region adapter that we have provided, and it hasn’t been maintained/updated since Josh Smith originally wrote it, is the NCAL on CodePlex .
The issue occurs because a new CompositeView is being created when the outer pane is made to float. That is happening because you set the Theme property of the XamDockManager. That means that the elements within have an implicit Style applied. Well when they come out of the visual tree (as would have to happen in order to move the elements into the floating window or anywhere else in the visual tree for that matter) WPF is releasing the old templates (because that implicit style isn’t available) and then ultimately they will get new templates (when they get put back into the visual tree).
Since the region adapter you are using is setting the Content of the ContentPane to the VM and there is a DataTemplate that will ultimately provide the visual for that VM that it is the ContentPresenter within the template of the ContentPane that will ultimately create the element from the DataTemplate. When the template of the ContentPane is released by WPF when the visual tree changes the ContentPresenter and everything within it is gone. So when the ContentPane applies the implicit template again (during the Show for the floating window in this case), a new CompositeView is created.
The solution is not to set the Content of the ContentPane to the VM. Instead set it to a ContentControl, where the Content of that is the VM. In that way, the ContentControl will retain its template and therefore the ContentPresenter within it will retain the element it created to represent that Content.
e.g.
private void AddItems(IRegion region, TabGroupPane regionTarget) { region.ActiveViews.CollectionChanged += (sender, e) => { if (e.NewItems == null) return; ContentPane pane = new ContentPane(); var view = region.ActiveViews.LastOrDefault(); if (view != null) { //pane.Content = view; var cc = new System.Windows.Controls.ContentControl(); cc.Content = view; pane.Content = cc; pane.Header = "Test" + count; pane.AllowDockingFloating = false; regionTarget.Items.Add(pane); pane.BringIntoView(); } count++; }; }