本文介绍了Framework.Triggers和Style.Triggers之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有两个类型相同的特性,但存在于不同的班级。

There are two properties of same type but exists in different classes.




  • FrameworkElement.Triggers Property
  • Style.Triggers Property

这混淆了我很多,所以我一直几个问题的答案我在寻找:

This confuses me a lot, and so I've few questions whose answer I'm looking for:


  • 为什么存在两个同类型的属性?

  • 当我应该用什么呢?

  • 什么人能做到,其他不能?

推荐答案

由于您已链接到问题的文档页说:

As the documentation page that you've linked to in the question says:

FrameworkElement.Triggers只能包含EventTriggers并且通常不使用。您不能定义(基于属性)触发或(数据绑定值为主)用这种方法DataTriggers。

FrameworkElement.Triggers can only contain EventTriggers and is not usually used. You cannot define (Property based) Triggers or (data-bound value based) DataTriggers with this method.

有关最实用的目的,您应该使用Style.Triggers或DataTemplate中.Triggers或ControlTemplate.Triggers。 (对不起,增加了混乱)。

For most practical purposes, you should be using Style.Triggers or DataTemplate.Triggers or ControlTemplate.Triggers. (Sorry for adding to the confusion).

这篇关于Framework.Triggers和Style.Triggers之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 14:31