I am writing a control that inherits from RadioButton and does nothing more impressive than displaying the image and hiding the default circle.
One thing I couldnβt find out about is that I need to VisualStates all VisualStates again in my ControlTemplate, or can I just place them as an empty element and are they inherited?
My XAML is below, the original RadioButton is on MSDN .
<Style TargetType="local:ImageRadioButton"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:ImageRadioButton"> <Grid> <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualState x:Name="Normal"/> <vsm:VisualState x:Name="MouseOver"> <Storyboard/> </vsm:VisualState> <vsm:VisualState x:Name="Pressed" /> <vsm:VisualState x:Name="Disabled"/> </vsm:VisualStateGroup> <vsm:VisualStateGroup x:Name="CheckStates"> <vsm:VisualState x:Name="Checked"> <Storyboard/> </vsm:VisualState> <vsm:VisualState x:Name="Unchecked"/> </vsm:VisualStateGroup> <vsm:VisualStateGroup x:Name="FocusStates"> <vsm:VisualState x:Name="Focused" /> <vsm:VisualState x:Name="Unfocused" /> </vsm:VisualStateGroup> <vsm:VisualStateGroup x:Name="ValidationStates"> <vsm:VisualState x:Name="Valid"/> <vsm:VisualState x:Name="InvalidUnfocused" /> <vsm:VisualState x:Name="InvalidFocused" /> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <ContentPresenter/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
source share