是否有可能负载一个不同的数据模板的定义列在WPF数据网?
我XAML看起来是这样的:
<DataGridTemplateColumn Header="Select">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox
HorizontalContentAlignment="Center"
Visibility="{Binding IsStarted}"
VerticalAlignment="Center"
IsChecked="{Binding IsStarted, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Command="{Binding DataContext.Checked,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
CommandParameter="{Binding}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
这里的目标被载入一个单独的数据模板当结合 IsStarted
被设置为虚假的,换句话说的时候能见度设置错误的。
预期在这里的目的是,当某个按钮而被触发,将布尔以"虚假"的另一个数据模板将是可见的,在这个非常的自己的专栏而不是目前现有的项目。
作为例子,下面XAML应该显示一旦布尔被设定为虚假之后执行的按钮,
<TextBlock Visibility="{Binding IsTrue}" Text="Hello" />
这可能吗?