我知道我的标题不清楚,但这是我的问题:
我有1个datagrid,它有2列。百分比和Abs Amt。
现在,如果百分比> 0,Abs Amt应为零,反之亦然。
我尝试使用DataTriggers做这件事,但我迷路了并且废弃了所有东西......
这是我的代码:
<DataGrid>
<DataGrid.Columns>
<DataGridTemplateColumn Header="Percentage"
CellTemplate="{StaticResource local.Percentage}" />
<DataGridTemplateColumn Header="Absolute Amt"
CellTemplate="{StaticResource local.AbsAmt}" />
</DataGrid.Columns>
</DataGrid>
<DataTemplate x:Key="local.Percentage">
<Grid>
<Border Height="30"
Margin="-2"
Background="White"
BorderBrush="{DynamicResource TextBoxBorderBrush}"
BorderThickness="1">
<TextBox x:Name="percentage"
Text="{Binding value-binded-to-VM, UpdateSourceTrigger=PropertyChanged}"
Margin="0,0,2,4"
Height="Auto"
VerticalAlignment="Bottom"
BorderThickness="0"
Style="{StaticResource TextBoxStyle}" />
</Border>
</Grid>
</DataTemplate>
<DataTemplate x:Key="local.AbsAmt">
<Grid>
<Border Height="30"
Margin="-2"
Background="White"
BorderBrush="{DynamicResource TextBoxBorderBrush}"
BorderThickness="1">
<TextBox x:Name="abscharge"
Text="{Binding value-binded-to-VM, UpdateSourceTrigger=PropertyChanged}"
Margin="0,0,2,4"
Height="Auto"
VerticalAlignment="Bottom"
BorderThickness="0"
Style="{StaticResource TextBoxStyle}" />
</Border>
</Grid>
</DataTemplate>
是否可以控制另一个细胞的细胞?或者我应该在保存之前在VM上进行验证??
TIA!