我有WPF comboBoxEdit的问题。我像这样加载值:
comboBoxEdit1.ItemsSource = dtCat.DefaultView;
值已加载,一切正常,但当我从下拉列表中选择一些值时,在组合框中,我看不到“DisplayMember”值,而是“ValueMember”值(某个数字ID)。 我做错了什么?我想在选择某个项目时看到DisplayMember值。 感谢
答案 0 :(得分:0)
这是我的负担:
DataTable dtCat = SqlHelper.GetTable("base_UserCategory_Select", new string[] { });
DataRow dr = dtCat.NewRow();
dr["UserCategoryID"] = 0;
dr["CategoryName"] = "< All >";
dr["IsSystem"] = "False";
dtCat.Rows.InsertAt(dr, 0);
comboBoxEdit1.ItemsSource = dtCat.DefaultView;
comboBoxEdit1.SelectedIndex = 1;
这是我的XAML:
<dxe:ComboBoxEdit Height="20" Margin="14,64,0,0" Name="comboBoxEdit1"
DisplayMember = "CategoryName" ValueMember = "UserCategoryID" VerticalAlignment="Top"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
HorizontalAlignment="Left" Width="254" />