Q:

How to add an event to each ComboBoxItem

I have a ComboBox (using WPF), to which I add Items with C#. Im only adding strings, how can i also add an Event ex. Selected (I want to know which item user selects) to each item I add.
This is how im adding items:
Znamka.Items.Add(temp.Znamka.ToString());

Thanks for your help!

A:

If Znamka is your combo box, you would set an event handler on Znamka for the SelectionChanged event (can be done in XAML). This fires anytime the selection changes, and the actual item selected is referenced in the SelectionChangedEventArgs (AddedItems property) that gets passed to your event handler.

