<DataGridTemplateColumn Width="100" Header="实测值">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<ComboBox
Name="combobox"
Width="80"
Margin="2,0,0,2"
DisplayMemberPath="Value"
ItemsSource="{Binding ComSors}"
IsEnabled="{Binding isUnCompelete}"
SelectedIndex="0"
SelectedItem="{Binding STA, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key"
Text="{Binding QTY, Mode=TwoWay}"
Visibility="{Binding REF_VALUE, Converter={StaticResource OKVisibilityConvertor}}" />
<TextBox
Width="80"
Height="25"
Margin="2,0,0,2"
Foreground="{Binding STATUS, Converter={StaticResource ResourceKey=ColorConvertor}}"
IsReadOnly="{Binding isCompelete, Mode=TwoWay}"  <!--这里的isCompelete值一定要是网格绑定的列表对应的值,而不是VM上面的值-->
Text="{Binding QTY, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
Visibility="{Binding REF_VALUE, Converter={StaticResource OKVisibilityConvertorText}}" />

</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

05-11 22:07