【发布时间】:2009-12-01 08:53:22
【问题描述】:
我在我的 WPF 应用程序中使用 devexpress comboBoxEdit 组件。我给它赋值是这样的:
private void Users1_Load()
{
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;
}
我的xml:
<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" />
但问题是,在这个组合框中我看到了我的 id(值成员),只有当我展开它时,我才会看到 DisplayMember 值。什么问题,怎么做才能总是看到文本值,而不是我的 id ......?
【问题讨论】:
标签: wpf combobox devexpress