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

Combo box with multiple columns

$
0
0

Hi,

I am trying to display multiple columns in a combo box using MVVM, but currently I can only show one column by using "DisplayMemberPath" property.  ItemsSource property is bound to IList collection exposed as a property in ViewModel class. 

I've browsed and found that it's not very straightforward to implement, the suggestions I found are based on creating DataTemplate and in it create separate textblocks for each column within a stackpanel.  Then bind the DataTemplate to Combo's ItemTemplate property.

Is the above method the right way of doing it in MVVM.  If so then should I create each public property for the columns in my ViewModel class?

Any suggestions please ?


Viewing all articles
Browse latest Browse all 18858

Latest Images

Trending Articles



Latest Images

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