Question

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..?

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top