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
714
How to show empty string as DisplayText instead of value when value is not found in combo's ItemsSource
posted

Hi,

I have a XamComboEditor which is bound to an ItemsSource which has a list of custom Entity instances. Entity has an integer Id and string Code properties. I set the ValuePath="Id" and DisplayMemberPath="Code". And I also set the Value property of combo to a property named "SelectedValue" on window in order to explain my problem.

The thing when the SelectedValue is 0, so the Value of Combo, the display text on XamComboEditor shows "0" since there is no Entity with Id = 0 in ItemsSource. What I want the combo is to show NOT 0 but empty string when the value is not found in ItemsSource. There is an option for that in some components but couldn't find on XamComboEditor. I've also tried to use ValueToTextConverter and ValueToDisplayTextConverter to convert 0 to String.Empty but they didn't work either.

I've attached the sample project in order to show the problem.

Can somebody help me out?

Thanks in advance

ComboNotFoundValueText.zip
Parents Reply Children
No Data