Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug VisualStateManager in runtime

There are very helpful tools out there to debug WPF applications in run-time like Snoop, WPF Inspector and Xaml Spy which allow you to sneak peek into running application and monitor property values, DataContext changes, routing events and even triggers switching.

But what I did not managed to find in any of them is the way how to monitor VisualStateManager (VSM) transitions between states on particular selected control in run-time.

Is there any tool that could help with figuring out why a control doesn't go into the particular expected state (considering absence of source code for this application/library)?

Update: The question is mostly about debugging compiled code, when you have no access to the source. For cases when you have access to source code here is pretty good explanation of one of the ways to go.

like image 437
Sevenate Avatar asked Jul 26 '13 13:07

Sevenate


1 Answers

There are some reasons why a control does not transect its states.

There might be more than one VisualStateGroup and its has been named as something.

Calling a visual state before a control is loaded.

VisualState will be applied only after the control's OnApplyTemplate call.

if there are any syntax error.

How ever the Visual states are not able to tract with something but it can be debugged with the return value of GoToState method.

Hope this would helpful..

like image 183
Sankarann Avatar answered Oct 29 '22 05:10

Sankarann