Two way animation

前端 未结 2 693
陌清茗
陌清茗 2021-01-25 03:27

I\'m triying to hide/show a stackpanel when I click in a button. This is what I made so far:


    

        
2条回答
  •  臣服心动
    2021-01-25 03:29

    What about a little trick: Together with the storyboard you have in place now, you are hidding the current button and setting another button (which looks the same) visible. The other button has the reverse storyboard, and reverse button visibility settings. With that you don't have to worry about a state, and you can do it only in XAML.

    Other Idea would be to handle the click in the code behind, maintain a flag there, and trigger the storyboard from the code. As this is a view-only functionality I don't see a conflict with MVVM.

提交回复
热议问题