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
130
XamComboEditor and ViewModel Property
posted

My scenario is giving me a headache and I'd appreciate some help! I have a XamComboEditor defined as the editor type for a field in a XamDataGrid. This grid is the 'details' section of a master-details form and this particular ComboEditor gets its list values from a list of products.

The list of products available however depends upon a selection in the master part of the form; basically if there is a quantity of product in stock greater than zero then that product will appear in the list. The BindingPath for the field is 'ProductID', which is a property on the details sections' underlying ViewModel. This is all fine when entering a completely new master-detail record. My combolist (in edit mode) displays an overriden ToString() method from the underlying class that combines a category and description. The ProductID from that underlying class binds to the ViewModel property on selection. Obviously, when the ComboEditor does NOT have focus, my user needs to see the result of the overriden ToString() method in the text portion.

My issue is that when one of these forms is later viewed, perhaps as the result of a search, the text portion of the ComboEditor (i.e. not in edit mode) will ONLY display the underlying ProductID if the current, REALTIME quantity of that product is now zero. If there is still some quantity remaining, the text portion DOES show what I need the user to see. I understand why this is I think, but it seems to me that the text portion always relies on what is in the combo list of items in order to determine what it displays when not in edit mode.

My question is, how do I get the non-edit mode text portion of the ComboEditor to show a derived property on my ViewModel (which WILL show my category/description) based soley on the underlying data of that detail record and NOT based on what's currently available in the list (when ComboEditor NOT in edit mode)

In other words, is there a way for a XamComboEditor to look at the underlying ViewModel for its non-edit display information, whilst still being able to display the required list when in edit mode?

Thanks in advance for any help, I've tried many things but to noi avail!

  • 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 a converter for the XamComboEditor’s ValueToDisplayTextConverter property and return the String you want to be shown, when the Editor is not in edit mode.

     

    Feel free to write me if you have further questions.