views:

143

answers:

1

I'd like to use a WPF ComboBox in a similar way to the Flag column on Outlook where you are presented with a choice of different flags to select.

My flags will be stored as Integers in the DB, each number is represented by a different color flag.

Has anybody already done this or similar. Failing that any pointers to the best way to achieve this?

+3  A: 

Assuming you are using a 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 by the int value and the return the brush/color you would like for that number. Then in your template you can use this value converter in the databinding expression.

McAravey