Window节点加上下面的
xml
<Window.Resources>
<FrameworkElement x:Key="ProxyElement" DataContext="{Binding}" />
</Window.Resources>
然后随便加一个隐藏控件
xml
<ContentControl Content="{StaticResource ProxyElement}" Visibility="Collapsed" />
然后绑定
xml
<DataGridTextColumn
Width="*"
Binding="{Binding CompoundName}"
Header="组分名"
IsReadOnly="True"
Visibility="{Binding DataContext.FileListVisibility, Source={StaticResource ProxyElement}}" />