2011-12-15 78 views

回答

4

如果你有一組,或想找到一個特定組的狀態,你可以這樣做:

<VisualStateManager.VisualStateGroups> 
     <VisualStateGroup x:Name="Group1"> 
      <VisualState x:Name="State1"> 
       <Storyboard> 

       </Storyboard> 
      </VisualState> 
      <VisualState x:Name="State2"> 
       <Storyboard> 

       </Storyboard> 
      </VisualState> 
     </VisualStateGroup> 
    </VisualStateManager.VisualStateGroups> 

,並在你的代碼,你可以這樣做:

var state = Group1.CurrentState; 
Console.WriteLine(state.Name);