我在LayoutGroup中有一些LayoutPanels。我需要处理pin/unpin事件,这样我就可以在UI的某个地方选中/取消选中复选框控件。我试过这样写:
<dxd:LayoutPanel x:Name="OverviewPanel"
ItemWidth="200"
Caption="{Binding Source={StaticResource MainWindowResources}, Path=Resource.Overview}"
ShowCloseButton="False"
dxd:DockLayoutManager.DockItemCollapsed="OverviewPanel_DockItemCollapsed"
AllowDrag="False"
AllowFloat="False"
AllowContextMenu="False"
Padding="1"
dxd:AutoHideGroup.AutoHideType="Left"
>
<TextBox BorderThickness="0" />
</dxd:LayoutPanel>
和后面的代码:
private void OverviewPanel_DockItemCollapsed(object sender, DevExpress.Xpf.Docking.Base.DockItemCollapsedEventArgs e)
{
cOverview.IsChecked = false;
}
这行不通。
LayoutGroup的父类是另一个LayoutGroup,它们都在DockLayoutManager中
使用DockLayoutManager。DockOperationCompleted事件:
XAML标记:<dxd:DockLayoutManager
DockOperationCompleted="DockLayoutManager_DockOperationCompleted"
>
...
</dxd:DockLayoutManager>
后台代码:
void DockLayoutManager_DockOperationCompleted(object sender, DockOperationCompletedEventArgs e) {
switch(e.DockOperation) {
case DevExpress.Xpf.Docking.DockOperation.Hide:
// dock panel hidden to auto-hide tray(pinned)
break;
case DevExpress.Xpf.Docking.DockOperation.Dock:
// dock panel docked to layout (e.g. unpinned from auto-hide tray)
break;
}
}
相关帮助文章:自动隐藏组