J'écris un contrôle qui hérite d'un RadioButton
et ne fait rien de plus spectaculaire que d'afficher une image et de cacher le cercle par défaut. Une chose que je n'ai pas été capable de savoir est de savoir si je dois ré-implémenter tous les VisualStates
dans mon ControlTemplate, ou est-ce que je peux simplement les mettre comme un élément vide et ils sont hérités?Héritage VisualState dans Silverlight
Mon XAML est ci-dessous, 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/> <!-- mouseover -->
</vsm:VisualState>
<vsm:VisualState x:Name="Pressed" />
<vsm:VisualState x:Name="Disabled"/>
<!-- TODO -->
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="CheckStates">
<vsm:VisualState x:Name="Checked">
<Storyboard/>
<!-- checked -->
</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>
Y at-il un point comprenant le ' ' , ' ' etc éléments vides? –