8,756
社区成员




<DataGridComboBoxColumn Header="数量" TextBinding="{Binding CurrentStyle}" MinWidth="100" >
<DataGridComboBoxColumn.ElementStyle >
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding MarkupStyle}" />
<Setter Property="SelectedValue" Value="{Binding ApplicableParty}" />
<Setter Property="SelectedValuePath" Value="{Binding CurrentParty}" />
<Setter Property="DisplayMemberPath" Value="{Binding Style}" />
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle >
<Style TargetType="ComboBox" >
<Setter Property="ItemsSource" Value="{Binding MarkupStyle}" />
<Setter Property="SelectedValue" Value="{Binding ApplicableParty}" />
<Setter Property="SelectedValuePath" Value="{Binding CurrentParty}" />
<Setter Property="DisplayMemberPath" Value="{Binding Style}" />
</Style>
</DataGridComboBoxColumn.EditingElementStyle >
这个怎么用 设置SelectedIndex属性
private void BagInfo_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
{
if (e.AddedCells.Count == 0)
return;
var currentCell = e.AddedCells[0];
if (currentCell.Column == BagInfo.Columns[5]) //Columns[]从0开始 我这的ComboBox在第六列 所以为5
{
BagInfo.BeginEdit(); // 进入编辑模式 这样单击一次就可以选择ComboBox里面的值了
}
}
写了个这个点一次能出来了,如何能不点也出来啊设置SelectedIndex属性