English 中文(简体)
WPF comboBoxEdit
原标题:

i Have problem with WPF comboBoxEdit. I load values it it like this:

comboBoxEdit1.ItemsSource = dtCat.DefaultView;

Values are loaded, everything works good, but when i select some value from dropdown, in combobox i see not the "DisplayMember" value, but the "ValueMember" value (some numeric ID). What i do wrong?I want to see DisplayMember value when i select some item. Thanks

问题回答

Here my is 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;

Here is my 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" />




相关问题
WPF Datagrid, Setting the background of combox popup

I would like to change the color of the popup background when using a DatagridComboboxColumn in the WPF Toolkit datagrid. I ve edited the Template for a normal Combobox and it works great for selected ...

How to insert ComboBox item into ListBox? [winforms]

The question is very simple, How to insert ComboBox selected item into ListBox using c#? I have tried with this: listbox.Items.Add(combobox.SelectedItem); and some other permutations but it always ...

How do I bind a ComboBox to a one column list

I ve seen how to bind a ComboBox to a list that has columns like this: ItemsSource="{Binding Path=Entries}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedValue="{Binding Path=Entry}" But ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...

热门标签