0

How can I know which VisualState of control already defined in XAML?

For example, WPF Button control has 2 VisualStateGroups by default. They are "CommonStates" and "FocusStates". The "CommonStates" contains 4 VisualState: "Normal", "MouseOver", "Pressed", "Disabled". These states already have default handlers so when the mouse over or pressed, Button's VisualState changes corresponding. Thank you for reading!

namhnz
  • 75
  • 1
  • 10

2 Answers2

0

The wpf designer of visual studio has an "edit template" function. You can use that to veiw any control's default template. You can do that by follow the steps:

  1. Add the control to designer correctly.
  2. Right click the control -> Edit Template -> Edit a Copy.

If you can't do that, you still can get templates of standard wpf controls from msdn https://learn.microsoft.com/dotnet/framework/wpf/controls/control-styles-and-templates

Alex.Wei
  • 1,798
  • 6
  • 12
0

I just have found the list of VisualState which is built-in with Button control right here: Button VisualStates

You can also find the list for other control there.

namhnz
  • 75
  • 1
  • 10