WPF Combox使用 Text无法选择精确获取CHange后的Text
使用固定ComboxItem 无法通过 selectitem as object 来举行归去到 Content内的对香数据。那我只能这个样干:private void CBPaiweiLeixingSelect_Change(object sender, SelectionChangedEventArgs e)
{
ComboBox ThisBox = sender as ComboBox;
List<EDaxiaosuixi> ListShuixiE;
ComboBoxItem SelectItemTextBox = CBPaiweiType.SelectedItem as ComboBoxItem;
string SelectItemstr = SelectItemTextBox.Content as string;
if (SelectItemstr == "非吉祥牌位")
{
ListShuixiE = ThisPaiweilist.Where(x => x.PaiweiType != EPaiweiType.吉祥牌位).Select(x => x.DaxiaoSuixi).Distinct().ToList();//获取大小随喜
CBPaiweiGuige.ItemsSource = ListShuixiE;
}
else if (SelectItemstr == "吉祥牌位")
{
ListShuixiE = ThisPaiweilist.Where(x => x.PaiweiType == EPaiweiType.吉祥牌位).Select(x => x.DaxiaoSuixi).Distinct().ToList();//获取大小随喜
CBPaiweiGuige.ItemsSource = ListShuixiE;
}
}
使用这个方法:
List<EDaxiaosuixi> ListShuixiE;
ComboBoxItem SelectItemTextBox = CBPaiweiType.SelectedItem as ComboBoxItem;
string SelectItemstr = SelectItemTextBox.Content as string;
SelectItemstr 就是要获取的便跟过来的数据。
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]