views:

31

answers:

1

Hi,

I want to bind a List to a WPF combobox in xaml. Wondering what is the simplest way to do it.

(The reason behind is I want to maintain the years as integer rather than doing the type conversion from string to int. I get a list of years(2009,2010,2011) from the DB and want to be able to bind this to the combo and get the selected value also in int.)

Thanks, Mani

A: 

Simply bind the combo to an ObservableCollection<int> if you want 2 way db or List<int> for one way and retrieve the selected year by using SelectedItem

vc 74
my bad, I missed to test the basics and started going through the value converter and stuff. It is pretty straight forward and binding any string or object. Thanks.
Mani