I am using the following markup in WPF:

        <EventTrigger RoutedEvent="RadioButton.Checked" SourceName="xmlRadioButton">
                <BeginStoryboard Storyboard="{StaticResource ShowXmlPanel}"/>
        <EventTrigger RoutedEvent="RadioButton.Checked" SourceName="adiRadioButton">
                <BeginStoryboard Storyboard="{StaticResource ShowAdiPanel}"/>

Though this works fine when I run the code, I get the following error in the designer window of VS 2008:

Value 'RadioButton.Checked' cannot be assigned to property 'RoutedEvent'. Invalid event name.

Any idea why, and how can I fix this?

Was it helpful?


RadioButton is a ToggleButton. The designer does support the attached ToggleButton properties, but not the RadioButton ones (except in a RadioButton tag of course).

You need to use the class name that defines the property/event for the designer to accept it (thought there is no difference at runtime, since RadioButton IS a ToggleButton as I said, but the designer is not a real compiler).

So in your case, use <EventTrigger RoutedEvent="ToggleButton.Checked ..." ;-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow