更改选项卡项时不关闭浮动窗口

时间:2017-06-08 10:05:23

标签: c# .net wpf tabcontrol avalondock

目前,我开发了一个包含 TabControl 的WPF应用程序,以允许访问每个插件。

每个插件都使用 AvalonDock ,并且有不同的窗口可以停靠,浮动或隐藏。

当我在plugin1中浮动一个窗口并且在插件插件中插入插件后,浮动窗口消失(这是正常的)但我希望当我切换插件2时,插件1的浮动窗口不会消失(如以下屏幕)。

第1步:

enter image description here

第2步:

enter image description here

第3步:

enter image description here

浮动窗口消失的当前代码

        <TabControl>
        <TabItem>
            <TabItem.Header>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Blue" Foreground="Blue" />
                </StackPanel>
            </TabItem.Header>
            <xcad:DockingManager x:Name="DockingManager">
                <xcad:LayoutRoot>
                    <xcad:LayoutPanel Orientation="Horizontal">
                        <xcad:LayoutDocumentPaneGroup Orientation="Vertical" x:Name="ScriptGroup">
                            <xcad:LayoutDocumentPane x:Name="ScriptPanel" PaneName="ScriptPanel">
                                <xcad:LayoutDocument Title="1-1" >
                                    <TextBlock Text="1-1" Foreground="Blue"  />
                                </xcad:LayoutDocument>
                                <xcad:LayoutDocument Title="1-2">
                                    <TextBlock Text="1-2" Foreground="Blue" />
                                </xcad:LayoutDocument>
                                <xcad:LayoutDocument Title="1-3">
                                    <TextBlock Text="1-2" Foreground="Blue" />
                                </xcad:LayoutDocument>
                                <xcad:LayoutDocument Title="1-4">
                                    <TextBlock Text="1-2" Foreground="Blue" />
                                </xcad:LayoutDocument>
                            </xcad:LayoutDocumentPane>
                        </xcad:LayoutDocumentPaneGroup>
                    </xcad:LayoutPanel>
                </xcad:LayoutRoot>
            </xcad:DockingManager>
        </TabItem>
        <TabItem>
            <TabItem.Header>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Red" Foreground="Red" />
                </StackPanel>
            </TabItem.Header>
            <xcad:DockingManager x:Name="DockingManager2">
                <xcad:LayoutRoot>
                    <xcad:LayoutPanel Orientation="Horizontal">
                        <xcad:LayoutDocumentPaneGroup Orientation="Vertical" x:Name="ScriptGroup2qdrgqr">
                            <xcad:LayoutDocumentPane x:Name="ScriptPanel2qrgtqr" PaneName="ScriptPanel">
                                <xcad:LayoutDocument Title="1-1">
                                    <TextBlock Text="1-1"  Foreground="Red" />
                                </xcad:LayoutDocument>
                                <xcad:LayoutDocument Title="1-2">
                                    <TextBlock Text="1-2" Foreground="Red"/>
                                </xcad:LayoutDocument>
                                <xcad:LayoutDocument Title="1-3">
                                    <TextBlock Text="1-2" Foreground="Red"/>
                                </xcad:LayoutDocument>
                                <xcad:LayoutDocument Title="1-4">
                                    <TextBlock Text="1-2" Foreground="Red"/>
                                </xcad:LayoutDocument>
                            </xcad:LayoutDocumentPane>
                        </xcad:LayoutDocumentPaneGroup>
                    </xcad:LayoutPanel>
                </xcad:LayoutRoot>
            </xcad:DockingManager>
        </TabItem>
        <TabItem>
            <TabItem.Header>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="Green" Foreground="Green" />
                </StackPanel>
            </TabItem.Header>
            <xcad:DockingManager x:Name="DockingManager3">
                <xcad:LayoutRoot>
                    <xcad:LayoutPanel Orientation="Horizontal">

                        <xcad:LayoutDocumentPaneGroup Orientation="Vertical" x:Name="ScriptGroup3">
                            <xcad:LayoutDocumentPane x:Name="ScriptPanel3" PaneName="ScriptPanel">
                                <xcad:LayoutDocument Title="1-1">
                                    <TextBlock Text="1-1" Foreground="Green" />
                                </xcad:LayoutDocument>
                                <xcad:LayoutDocument Title="1-2">
                                    <TextBlock Text="1-2" Foreground="Green"/>
                                </xcad:LayoutDocument>
                                <xcad:LayoutDocument Title="1-3">
                                    <TextBlock Text="1-2" Foreground="Green"/>
                                </xcad:LayoutDocument>
                                <xcad:LayoutDocument Title="1-4">
                                    <TextBlock Text="1-2" Foreground="Green"/>
                                </xcad:LayoutDocument>
                            </xcad:LayoutDocumentPane>
                        </xcad:LayoutDocumentPaneGroup>
                    </xcad:LayoutPanel>
                </xcad:LayoutRoot>
            </xcad:DockingManager>
        </TabItem>
    </TabControl>

是否可以通过保持当前的机制来做到这一点? (使用Tabcontrol&amp; Avalondock)

如果答案是否定的,你能否告诉我最好的方法是什么?

0 个答案:

没有答案