我在LayoutGroup中有一些LayoutPanel。我需要处理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中。
答案 0 :(得分:2)
使用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;
}
}
相关帮助文章:Auto-Hide Groups。