Skip to content

Instantly share code, notes, and snippets.

@naotaco
Created August 16, 2015 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naotaco/ece74f2c3b785e33eba9 to your computer and use it in GitHub Desktop.
Save naotaco/ece74f2c3b785e33eba9 to your computer and use it in GitHub Desktop.
A sample CS code for VisualState
private void Page_Loaded(object sender, RoutedEventArgs e)
{
InitializeVisualStates();
}
private void InitializeVisualStates()
{
var groups = VisualStateManager.GetVisualStateGroups(LayoutRoot);
groups[0].CurrentStateChanged += (sender, e) =>
{
Debug.WriteLine("Width state changed: " + e.OldState.Name + " -> " + e.NewState.Name);
};
groups[1].CurrentStateChanged += (sender, e) =>
{
Debug.WriteLine("Height state changed: " + e.OldState.Name + " -> " + e.NewState.Name);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment