原文:
WPF DataGrid 每行ComboBox 内容不同的设置方法
<toolkit:DataGridComboBoxColumn x:Name="DgCbcSignal" Header="信号源" SelectedItemBinding="{Binding SelectedSignal}" > <toolkit:DataGridComboBoxColumn.ElementStyle> <Style TargetType="ComboBox"> <Setter Property="ItemsSource" Value="{Binding Path=Signals}" /> </Style> </toolkit:DataGridComboBoxColumn.ElementStyle> <toolkit:DataGridComboBoxColumn.EditingElementStyle> <Style TargetType="ComboBox"> <Setter Property="ItemsSource" Value="{Binding Path=Signals}" /> </Style> </toolkit:DataGridComboBoxColumn.EditingElementStyle> </toolkit:DataGridComboBoxColumn>
按照上述方法能做到每行单独绑定。