Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Empty value in XamComboEditor if value doesnt exists in ComboBoxItemsProvider
posted

 

Hi,

I need display empty value in xamdatagrid if saved value GUID doesnt exists in ComboBoxItemsProvider.

But I still see GUID value.

THX for help.

 

 foreach (DataRow dr in dt.Rows)

 {

                provider.Items.Add(new Infragistics.Windows.Editors.ComboBoxDataItem(new             Guid(dr["id"].ToString()), dr["name"].ToString()));

   }

 

Style s = new Style(typeof(Infragistics.Windows.Editors.XamComboEditor));

Setter set = new Setter(Infragistics.Windows.Editors.XamComboEditor.ItemsProviderProperty, provider);

 

 s.Setters.Add(set);

 field.Settings.EditorStyle = s;

 

  • 138253
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking through your post and I suggest you use the following code in your XamComboEditor’s EditModeEnding event:

     

    XamComboEditor combo = (sender as XamComboEditor);
    if (combo.Value.ToString() != String.Empty)
    {
        if (!(combo.ItemsProvider.ItemsSource as ObservableCollection<Guid>).Contains(Guid.Parse(combo.Value.ToString())))
        {
            combo.Value = String.Empty;
        }
    }
    

     

    Feel free to write me if you have further questions.