如何将WPF组件添加到AvalonDock

时间:2011-01-31 21:45:38

标签: .net wpf avalondock

我已经创建了一个名为ChartPanel的WPF UserControl到我的.NET 4.0。我使用AvalonDock作为我的对接库。我有MainWindow的以下WPF代码:

        <ad:DockingManager x:Name="dockManager" Grid.Row="1">
            <ad:ResizingPanel Orientation="Horizontal">
                <ad:DockablePane>
                    <ad:DockableContent x:Name="fileFrame" Title="File List">
                        <TreeView Name="fileTree"/>                        
                    </ad:DockableContent>
                    <ad:DockableContent x:Name="viewFrame" Title="View List">
                        <TreeView Name="viewTree"/>
                    </ad:DockableContent>
                </ad:DockablePane>
                <ad:DocumentPane>
                    <ad:DocumentContent Name="dockContent"></ad:DocumentContent>

                </ad:DocumentPane>
            </ad:ResizingPanel>
        </ad:DockingManager>

如何将ChartPanel.xaml控件添加到DocumentPane或DocumentContent对象?注意:我不确定我应该将哪个对象添加到DocumentPane或DocumentContent。

1 个答案:

答案 0 :(得分:2)

基本上这样,它没有什么复杂的。它周围的标签将是DockableContent或DocumentContent。

    <ad:DockingManager x:Name="dockManager" Grid.Row="1">
        <ad:ResizingPanel Orientation="Horizontal">
            <ad:DockablePane>
                <ad:DockableContent x:Name="fileFrame" Title="File List">
                    <TreeView Name="fileTree"/>                        
                </ad:DockableContent>
                <ad:DockableContent x:Name="viewFrame" Title="View List">
                    <TreeView Name="viewTree"/>
                </ad:DockableContent>
            </ad:DockablePane>
            <ad:DocumentPane>
                <ad:DocumentContent Name="dockContent">
                     <yourNamespace:YourControl />                <----------HERE
                </ad:DocumentContent>

            </ad:DocumentPane>
        </ad:ResizingPanel>
    </ad:DockingManager>