在我的 Page.Resources 我有 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>
然后我创建 GridView:
<GridView Grid.Row="0" x:Name="GridView_ButtonsQuest"
ItemTemplate="{StaticResource gridviewQuestStyle}"
ItemsSource="{Binding Questions}" >
</GridView>
问题是一个列表:
public class Question
{
public string QuestNumb { get; set; }
public string QuestText { get; set; }
}
我的应用程序的逻辑是:
if(isAnswerRight)
{
VisualStateManager.GoToState(???, "Right", false);
}
else
{
VisualStateManager.GoToState(???, "Wrong", false);
}
请解释一下,我在 GoToState 方法的第一个参数中需要什么?