How do I programmatically get the current Visual State of a WPF FrameworkElement?

前端 未结 3 799
一整个雨季
一整个雨季 2021-02-19 10:47

How do I programmatically get the current Visual State of a WPF FrameworkElement? And by state I mean the states like \"Normal\", \"MouseOver\", \"Disabled\", etc.

EDIT:

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-19 11:43

    I feel you've missed the point of WPF here, it's the View not the Model. You should not be storing state in the View. Store state in your Model(s) and use the View to represent it. On that basis you don't need to read the state of the View, you already know it.

    I know this may seem like a lot of work at the moment but it'll pay you back in spades later.

提交回复
热议问题