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
415
XamDockManager is not preserving the layouts in docking and floating of the TabItems
posted

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:XamDockManager.Panes>

                <igDock:SplitPane Name="sp" UseLayoutRounding="True">                   

                    <igDock:ContentPane  Header="TuneData"/>

                    <igDock:ContentPane Header="Staus Log"/>                   

                </igDock:SplitPane>

            </igDock:XamDockManager.Panes>

        </igDock:XamDockManager>

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

Main.App.zip
Parents Reply
  • 138253
    Offline posted in reply to yugandher

    Hello,

     

    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++;
        };
    }
    

     

    Hope this helps you.

Children