kekus
kekus

Reputation: 59

No valid RoutedEventHandler

<Style TargetType="ComboBoxItem" x:Key="ComboBoxItemStyle">
            <EventSetter Event="Selected" Handler="status_SelectionChanged"/>
</Style>

status_SelectionChanged method:

public void status_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    MessageBox.Show("1");
}

Error: not valid System.Windows.RoutedEventHandler

why?

Upvotes: 0

Views: 145

Answers (2)

Arsen Mkrtchyan
Arsen Mkrtchyan

Reputation: 50712

Try

private void status_SelectionChanged(object sender, RoutedEventArgs e)

see ListBoxItem.Selected

Upvotes: 0

Justin Pihony
Justin Pihony

Reputation: 67065

I believe your method signature for SelectionChanged should use RoutedEventArgs e instead of SelectionChangedEventArgs e

Here is the MSDN showing the RoutedEventHandler signature

Upvotes: 2

Related Questions