Graphical representation of integer graphical representation of WPF Combobox
I would like to use a WPF ComboBox similar to the Flag column in Outlook where you are prompted to select different flags to choose from.
My flags will be stored as integers in the DB, each number is represented in a different color.
Has anyone already done this or similar. Otherwise, any pointers to a better way to achieve this?
+1
a source to share
1 answer
Assuming you are using the DataTemplate for the ComboBox, what you are looking for is a value converter. All you need to do is create a class and inherit from IValueConverter. Then switch to int value and return the brush / color you want for that number. Then in your template, you can use this value converter in the databinding expression.
+3
a source to share