views:

20

answers:

0

I have a Radio button as the DataTemplate for an ItemsControl with the style name: MainMenuButtons. In my styles, I am trying to create a VisualState for Checked and Unchecked but I can't seem to get the button to change. My MainMenuButtons style class has a Grid as the ControlTemplate and the Grid contains a Button called RadioProxy. Just seems like nothing I do is effecting the Button though.

<Grid>
    <vsm:VisualStateManager.VisualStateGroups>
       <vsm:VisualStateGroup
            x:Name="CommonStates">
            <vsm:VisualState
                x:Name="Normal" />
        </vsm:VisualStateGroup>
        <vsm:VisualStateGroup
            x:Name="CheckStates">
            <vsm:VisualState
                x:Name="Checked">
                <Storyboard>
                    <DoubleAnimation
                        Storyboard.TargetName="RadioProxy"
                        Storyboard.TargetProperty="(Button.Opacity)"
                        Duration="0"
                        To=".3" />
                </Storyboard>
            </vsm:VisualState>
            <vsm:VisualState
                x:Name="Unchecked">
                <Storyboard>
                    <DoubleAnimation
                        Storyboard.TargetName="RadioProxy"
                        Storyboard.TargetProperty="(Button.Opacity)"
                        Duration="0"
                        To="1" />
                </Storyboard>
            </vsm:VisualState>
        </vsm:VisualStateGroup>
    </vsm:VisualStateManager.VisualStateGroups>
    <Button
        x:Name="RadioProxy"
        Content="{TemplateBinding Content}" />
</Grid>

Here is the RadioButton implimentation

<ScrollViewer
    Grid.Row="1"
    Grid.Column="0">
    <ItemsControl
        x:Name="UIClassButtonBar"> 
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <RadioButton
                    Style="{StaticResource MainMenuButtons}"
                    Content="{Binding}"
                    Tag="{Binding}"
                    GroupName="MainMenuGroup"
                    Height="20"
                    Width="120"
                    Margin="0,3,0,1"
                    FontSize="12" />
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</ScrollViewer>