【发布时间】:2010-06-04 02:34:13
【问题描述】:
我想根据其相邻 DataGridComboBoxColumn 的 SelectedValue 是否 == 'Other' 来启用/禁用 DataGridTextColumn
我可以在下面的 ListBox 中进行这项工作,但这在我的 DataGrid 环境中不起作用,因为 DataGridComboBox 列没有 name 属性。
<ListBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Source={StaticResource CustomData}}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<ComboBox Name="operatorComboBox" SelectedValue="{Binding OperatorId}" ItemsSource="{Binding Source={StaticResource Operator}}" SelectedValuePath="Id" DisplayMemberPath="Name"></ComboBox>
<TextBox Text="{Binding Name}" Visibility="{Binding Path=SelectedValue, ElementName=operatorComboBox, Converter={StaticResource intToVis}}"></TextBox>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
那么这可以用 DataGrid 完成吗?
(我知道我已经更改了 ListBox 示例中的可见性,但将其更改为启用并不是一个巨大的飞跃。(显然,在适当的 DataGrid 中隐藏整个列将是一件坏事)
this 的问题与我所问的非常相似,我只是无法将解决方案分解成我所追求的
【问题讨论】: