I am using the following markup in WPF:
    <StackPanel.Triggers>
        <EventTrigger RoutedEvent="RadioButton.Checked" SourceName="xmlRadioButton">
            <EventTrigger.Actions>
                <BeginStoryboard Storyboard="{StaticResource ShowXmlPanel}"/>
            </EventTrigger.Actions>
        </EventTrigger>
        <EventTrigger RoutedEvent="RadioButton.Checked" SourceName="adiRadioButton">
            <EventTrigger.Actions>
                <BeginStoryboard Storyboard="{StaticResource ShowAdiPanel}"/>
            </EventTrigger.Actions>
        </EventTrigger>
    </StackPanel.Triggers>
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?
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 ..." ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With