English 中文(简体)
WPF Devexpress ComboBoxEdit Items
原标题:

i use devexpress comboBoxEdit component in my WPF app. I assign values for it like this:

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;
}

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" />

But the problem is, that in this combobox i see my id s (Value Members), only when i expand it, then i see DisplayMember values. Whats the problem, how to do to allways see text values, not my id s..?

最佳回答

Add the

IsTextEditable="False"

to your xaml for the ComboBoxEdit. This is a known issue with the control, mentioned here. I use DX controls, and personally i think their Silverlight and WPF controls are a long way behind the rest of the market (their Silverlight controls are still beta, arguably when the ComboBoxEdit contains a bug like this then the WPF controls should be considered beta too). You might want to stick to the MS controls until DX fix their crap.

问题回答

If you need a more complex behaviour, you can use the DevExpress LookUpEdit component http://documentation.devexpress.com/#WindowsForms/clsDevExpressXtraEditorsLookUpEdittopic





相关问题
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 ...

热门标签