Silverlight ComboBox binding with Dictionary.
<combobox x:name=”cboCountry” displaymemberpath=”Value” width=”264” canvas.left=”129” canvas.top=”172” SelectionChanged=”cboCountry_SelectionChanged“/>
private void Page_Loaded(object sender, RoutedEventArgs e) {
Dictionary dict = new Dictionary();
dict.Add(1, “India”);
dict.Add(2, “USA”);
dict.Add(3, “FINLAND”);
cboCountry.ItemsSource = myDic;
}
private void cboCountry_SelectionChanged(object sender, SelectionChangedEventArgs e) {
KeyValuePair curItem = (KeyValuePair) cboCountry.SelectedItem;
MessageBox.Show(curItem.Key.ToString());
}










