debugging 如何在运行时调试VisualStateManager

41ik7eoe  于 2022-12-13  发布在  其他
关注(0)|答案(2)|浏览(178)

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.

f8rj6qna

f8rj6qna1#

控件不横切其状态有一些原因。
可能有一个以上的VisualStateGroup,而且其已命名为。
在加载控件之前调用可视状态。
VisualState将仅在控件的OnApplyTemplate调用之后应用。
如果存在任何语法错误,则将其设置为默认值。
然而,Visual状态无法跟踪某些内容,但可以使用GoToState方法的返回值进行调试。
希望这对你有帮助。

x9ybnkn6

x9ybnkn62#

我遇到这个问题是因为我添加了一个“<ControlTemplate.Triggers>“部分,所以我同时有“Style.Triggers”和“ControlTemplate.Triggers”,它一直工作,直到我单击列标题,这生成了错误“ExceptionObject {"La propriété '[Unknown]' ne pointe pas vers un DependencyObject du chemin '(0).(1)[1].(2)'."} object {System.InvalidOperationException}
第一个

相关问题