wpf中combobox选择
跟WINFORM以及WEB上不一样,例如这种是错误的:
foreach ( ComboBoxItem item in this.cb_usertype.Items )
{
item.IsSelected = CurrentModel.UserType == Convert.ToInt32(item.Tag);
}
正确的写法:
this.cb_usertype.SelectedIndex = CurrentModel.UserType;
原因没深究。
浙公网安备 33010602011771号