这是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
答案 0 :(得分: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();
}
答案 1 :(得分:1)
我知道这不是最好的方法,但您可以在应用程序中设置布局(使DockingPane自动隐藏),保存布局,然后在启动时加载它。
答案 2 :(得分:0)
的Xaml:
<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();
}