Categorized | Asp.net

Tags :

Silverlight ComboBox binding with Dictionary.

Silverlight ComboBox binding with Dictionary.

: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());

}

Leave a Reply


rss_32 twitter_32 facebook_32 linkedin_32 stumbleupon_32 friendfeed_32 google_32

Information

  • Premium News Home
  • Designed by Adii
  • Log in
  • Powered by Wordpress
  • Entries RSS
  • Comments RSS
Facebook Like Button for Dummies