I'm trying to define entirely a combobox using C#, however, I got stuck when I want to code the SelectionChanged event.
This is what I've got so far:
ComboBox cmb = new ComboBox();
cmb.Widht=75;
cmb.Margin = new Thickness(20,20,20,20);
cmb.VerticalAlignment = VerticalAlignment.Top;
cmb.HorizontalAlignment = HorizontalAlignment.Left;
cmb.SelectionChanged(cmb,cmb_SelectionChanged);
???????
aGrid.Children.Add(cmb);
private void cmb_SelectionChanged(object sender, SelectionChangedEventArgs e){ }
Any idea about what I'm doing wrong here?
Thanks in advance.
Asked
Active
Viewed 372 times
0

Pablo D.
- 172
- 1
- 2
- 11
-
What do you mean from Stuck? – Muhammad Saqlain Dec 05 '18 at 13:58
1 Answers
2
Here is the correct code:
cmb.SelectionChanged += new SelectionChangedEventHandler(cmb_SelectionChanged);
Regrads

György Gulyás
- 1,290
- 11
- 37