【发布时间】:2019-01-25 03:54:19
【问题描述】:
我在我的项目中创建了一个 avalon 停靠界面,例如,我想与 LayoutAnchorableItem 属性“Visibility”进行交互,但是如何将它实现到我的 XAML 代码中?我的 DockingManager.LayoutItemContainerStyle 分支中不能有两个样式定义...
我要添加的行:
<Setter Property="Visibility" Value="{Binding Model.IsVisible, ConverterParameter={x:Static Visibility.Hidden}, Converter={StaticResource btvc}, Mode=TwoWay}" />
我的原始 XAML 代码:
<dock:DockingManager DataContext="{Binding DockManagerViewModel}" DocumentsSource="{Binding Documents}" AnchorablesSource="{Binding Anchorables}" >
<dock:DockingManager.Resources>
<!-- add views for specific ViewModels -->
<DataTemplate DataType="{x:Type vmdock:SampleDockWindowViewModel}">
<uscontrol:SampleDockWindowView />
</DataTemplate>
</dock:DockingManager.Resources>
<dock:DockingManager.LayoutItemContainerStyle>
<!--you can add additional bindings from the layoutitem to the DockWindowViewModel-->
<Style TargetType="{x:Type dockctrl:LayoutItem}">
<Setter Property="Title" Value="{Binding Model.Title}" />
<Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}" />
<Setter Property="CanClose" Value="{Binding Model.CanClose}" />
<Setter Property="IsSelected" Value="{Binding Model.IsSelected}" />
</Style>
</dock:DockingManager.LayoutItemContainerStyle>
非常感谢!
【问题讨论】:
标签: c# wpf avalondock