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
20
Displaying an item not in the list
posted

I have several XamComboEditors on my form that have their item sources based on VVL tables from the database.  These drop-down lists should only be showing "active" records and are filtered as such with the select statement before being bound to the controls.  The problem is that some of the fields in my form's data have older values (now inactive) that are not contained in these drop-down lists so when I open the form, the text box for the XamComboEditor is blank.  How can I display these older values in the text box of the XamComboEditor without the item being shown in the drop-down list? 

Thanks,

B

Parents
No Data
Reply
  • 34510
    Suggested Answer
    Offline posted

    Hi Bonnie,

    The XamComboEditor can only select items that exist inside it's ItemsSource so if your older values are not in there then they can't be selected.  They won't show up in the TextBox area.  Something you can try doing is setting the EmptyText property to whatever text you want to display if the selected item doesn't match any items in the ItemsSource.  This will at least let you display something in the combo editor even if the SelectedItem you have bound does not exist in the ItemsSource.  Take a look at my attached sample.  I created a Behavior<T> that watches for selection changed notifications and updates the EmptyText accordingly.

    WpfApplication1.zip
Children
No Data