I am following the MVVM pattern with C# and WPF. In my .xaml.cs file, I have a combobox_SelectionChanged method where I need to access the selected item of the combobox.
var cb=sender as ComboBox;
Type t=cd.getType();
I tried to get the type and then the object bound to SelectedItem property. That was not scuccessful.
Then I tried the following. ComboBoxItem cbi = (ComboBoxItem)cb.SelectedItem;
string text = cbi.Content.ToString();
even that was not successful. Can someone suggest me a way to do that ?
Aucun commentaire:
Enregistrer un commentaire