Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How can I change which property DisplayMemberPath binds to, dynamically, whilst conforming to MVVM?

$
0
0

Part of my View has a listbox that lists users.  The underlying UserClassificationViewModel has a property that exposes a list of User ViewModels.  I want the user to be able to change the listbox between listing users by first name or by last name.

I could have the User view model expose two properties (FirstNameFirstDisplayName or LastNameFirstDisplayName).  But how would I dynamically change the binding in the listbox to select the appropriate property depending on the users view preference?I'm not sure if that's the best approach, but I'm open to suggestions...

Can a binding be based on another property value?  (What's the best MVVM approach to this?)

Thanks.

J


http://digitalcamel.blogspot.com/



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>