在我Page.Resources我有DataTamplate:如何使用的DataTemplate在metro應用使用GotoState函數
<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方法中的第一個參數?