2009-12-01 92 views
1

我在我的WPF應用程序中使用了devexpress comboBoxEdit組件。我賦值爲這樣的:WPF Devexpress ComboBoxEdit Items

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

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

但問題是,在這個組合框我看到我的ID(價值委員),只有當我展開它,然後我看到DisplayMember值。什麼是問題,怎麼做總是看到文本值,而不是我的ID ..?

回答

3

添加

IsTextEditable="False" 

到你的XAML的ComboBoxEdit。這是控制的一個已知問題,mentioned here。我使用DX控件,並且我個人認爲他們的Silverlight和WPF控件遠遠落後於其他市場(他們的Silverlight控件仍然是測試版,可以證明當ComboBoxEdit包含這樣的錯誤時,那麼WPF控件也應該被視爲beta )。你可能想堅持MS控制,直到DX修復他們的廢話。

+0

好,對於ansver和解決方案的感謝。似乎Devexpress有一些seriuos廢話。 – Vytas999 2009-12-01 14:34:27