2

这是 XAML 标记。我试图默认隐藏“工具”窗格。我在教程中看到过这样的内容:Command="ad:DockableContentCommands.ToggleAutoHide"。

       <ad:DockingManager Name="dockingManager">
        <ad:ResizingPanel Orientation="Horizontal" >

            <ad:ResizingPanel Orientation="Vertical">
                <ad:DockablePane>
                    <ad:DockableContent Title="Events">
                        ....
                    </ad:DockableContent>
                </ad:DockablePane>
            </ad:ResizingPanel>

            <ad:ResizingPanel Orientation="Horizontal" >
                <ad:DockablePane Name="tools" >
                    <ad:DockableContent Name ="search" > ... </ad:DockableContent>
                    <ad:DockableContent Name ="results" > ... </ad:DockableContent>
                </ad:DockablePane>
            </ad:ResizingPanel>

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

如何在标记或代码中默认隐藏/切换 DockingPane?

谢谢 RR

4

3 回答 3

5

您现在可能已经弄清楚了,但对其他人来说,这对我有用:

XAML:

       <ad:DockingManager Loaded="dockManager_Loaded">

        <...>

        <ad:DockableContent Name="dockName" >
            <TextBlock Text="Something HERE"/>
        </ad:DockableContent>

        <...>

C#:

    private void dockManager_Loaded(object sender, RoutedEventArgs e)
    {
         dockName.ToggleAutoHide();
    }
    private void aButton_Click(object sender, RoutedEventArgs e)
    {
         dockName.Activate();
    }
于 2011-08-19T00:05:28.953 回答
1

我知道这不是最好的方法,但您可以在应用程序中设置布局(使 DockingPane 自动隐藏),保存布局,然后在启动时加载它。

于 2010-12-20T09:05:57.450 回答
0

xml:

<ad:DockingManager Name="dockingManager"                        
                   Loaded="OnDockManagerLoaded" 
                   Mouse.MouseDown="dockingManager_MouseDown">
     <ad:ResizingPanel Orientation="Vertical">
          <ad:DockablePane x:Name="chartDockablePane">
               <ad:DockableContent x:Name="chartDockableContent" 
                                   DockableStyle="AutoHide">
                     <..some content/>
                </ad:DockableContent>
           </ad:DockablePane>
    </ad:ResizingPanel>
</ad:DockingManager>

后面的cs代码:

private bool _forcedToAutoHide;

private void OnDockManagerLoaded(object sender, RoutedEventArgs e)
{
    chartDockablePane.ToggleAutoHide();
    _forcedToAutoHide = true;
}

private void dockingManager_MouseDown(object sender, MouseButtonEventArgs e)
{
    if (!_forcedToAutoHide)
    return;
    _forcedToAutoHide = false;
    chartDockableContent.Activate();
    chartDockablePane.ToggleAutoHide();
}
于 2012-03-22T23:23:25.463 回答