In meiner Page.Resources habe ich DataTamplate:
<DataTemplate x:Key="gridviewQuestStyle">
<Button Content="{Binding QuestNumb}" Style="{StaticResource buttonQuestStyle}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="questionStates">
<VisualState x:Name="Right">
<Storyboard>
<ColorAnimation Storyboard.TargetName="BackgroundBrush" Storyboard.TargetProperty="Color" To="LightGreen" />
</Storyboard>
</VisualState>
<VisualState x:Name="Wrong">
<Storyboard>
<ColorAnimation Storyboard.TargetName="BackgroundBrush" Storyboard.TargetProperty="Color" To="Red" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Button.Background>
<SolidColorBrush x:Name="BackgroundBrush" Color="Black"/>
</Button.Background>
</Button>
</DataTemplate>
Dann erstelle ich GridView:
<GridView Grid.Row="0" x:Name="GridView_ButtonsQuest"
ItemTemplate="{StaticResource gridviewQuestStyle}"
ItemsSource="{Binding Questions}" >
</GridView>
Fragen ist eine Liste:
public class Question
{
public string QuestNumb { get; set; }
public string QuestText { get; set; }
}
Die Logik meiner Anwendung ist:
if(isAnswerRight)
{
VisualStateManager.GoToState(???, "Right", false);
}
else
{
VisualStateManager.GoToState(???, "Wrong", false);
}
Bitte erklären Sie, was ich im ersten Parameter der GoToState-Methode benötige?