我正在使用 devexpress,在上下文菜单上试图隐藏 RootPanel 中存在的许多 LayoutDocument 之一。
下面是文档 Pane xml 文件。
<LayoutDocumentPane>
<LayoutDocument Title=" View " IsSelected="True" ContentId="view" CanClose="False" LastActivationTimeStamp="10/15/2018 12:17:44" />
</LayoutDocumentPane>
Xaml代码如下
<xcad:LayoutDocument Title=" View " CanClose="False" ContentId="View" >
<dxg:GridControl Name="dataTable" EnableSmartColumnsGeneration="True"
ItemsSource="{Binding View_InfoTable,Mode=TwoWay,NotifyOnSourceUpdated=True,NotifyOnTargetUpdated=True}" SelectionMode="Row"
AutoGenerateColumns="AddNew" AllowColumnMRUFilterList="True" ShowAllTableValuesInFilterPopup="False">
<dxg:GridControl.View>
<dxg:TableView ShowAutoFilterRow="True" UseGroupShadowIndent="False" ShowGroupPanel="False" ShowCriteriaInAutoFilterRow="True" AllowSorting="False" BestFitMode="VisibleRows"
ShowFixedTotalSummary="False" >
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</xcad:LayoutDocument>
经过大量调试和搜索后,我还没有找到任何解决方案来隐藏停靠面板并在单击某个按钮时恢复它们。
最佳答案
我在尝试了很多天的错误之后找到了一个方法。
private void BarButtonItem_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
{
string currentDockPane = e.Item.Content.ToString();
switch (currentDockPane)
{
case "view":
var currentLayout= StandardDockManager.Layout.Descendents().OfType<LayoutAnchorable>().Where(x => x.ContentId == "view").FirstOrDefault();
//Get all the descendents of current dock manger and check for the LayoutAnchorable if its visible .
if (currentLayout.IsVisible)
(((Xceed.Wpf.AvalonDock.Layout.LayoutAnchorable)(currentLayout))).IsVisible = false;
else
(((Xceed.Wpf.AvalonDock.Layout.LayoutAnchorable)(currentLayout))).IsVisible = true;
break;
.......................
}
}
关于c# - 在 Avalon Dock 中,如何以编程方式隐藏 LayoutDocumentPane 项目并恢复它们,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52869506/