触发后恢复先前的值 [英] Restore previous value as a result of trigger

查看:69
本文介绍了触发后恢复先前的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我正在使用< Trigger Property = IsMouseOver Value = True>

如果IsMouseOver为假,如何恢复以前的值?

(例如,将的背景更改为绿色) IsMouseOver = true 并在更改之前还原为先前的颜色。先前的颜色可以在控件上自己设置,而不必在样式内)

(For example change background to green on IsMouseOver=true and revert to previous color before change. The previous color can be set on the control himself and not necessarily inside of the style)

Facets:


  1. 我在触发器中使用了stoaryboard

  2. 在我设置的控件样式中背景为蓝色

  3. 在带有控件的窗口的实现中,我将控件设置为样式,但将控件的背景设置为红色。

  4. 我想设置动画,将其从红色更改为绿色,当IsMouseOver = false再次将其恢复为红色时。

  1. I'm using stoaryboard in the trigger
  2. In the control style I set the background to Blue
  3. In the implementation of the window with the control i'm setting the control to the style but set the background of the control to Red.
  4. I want to set animation that will change it from red to green and when IsMouseOver=false revert it to red again.

请帮助我!

推荐答案

触发器不会永久更改值,它们可以是活动的,也可以是非活动的,如果它们是非活动的,则您将自动获取先前的值(根据优先级规则)。

Triggers do not permanently change the value, they can be active and inactive, if they are inactive you automatically get the previous value (according to rules of precedence).

模板触发器不会覆盖本地值,因此您必须使用默认值的设置器。

Template triggers will not override local values, so you have to use a setter for the default.

当您使用将覆盖所有其他内容的动画时,可以通过<$ c $对其进行动画处理c> Trigger.ExitActions ,但是您需要知道它的原始值。

As you use an animation that will override all other things, you can animate it back via the Trigger.ExitActions, but you will need to know the original value for that.

这篇关于触发后恢复先前的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆