zoukankan      html  css  js  c++  java
  • Silverlight:《Pro Silverlight5》读书笔记 之 Dependency Properties And Routed Event

    Dependency Properties And Routed Event

    Dependency Properties

    Dynamic Value Resolution

    As you’ve already learned, dependency properties depend on multiple different services, called property providers. To determine the current value of a property, Silverlight has to decide which one takes precedence. This process is called dynamic value resolution.

    1. Animations. If an animation is currently running and that animation is changing the property value, Silverlight uses the animated value.
    2. Local value. If you’ve explicitly set a value in XAML or in code, Silverlight uses the local value. Remember, you can set a value using the SetValue() method or the property wrapper. If you set a property using a resource or data binding, it’s considered to be a locally set value.
    3. Silverlight styles allow you to configure multiple controls with one rule. If you’ve set a style that applies to this control, it comes into play now.
    4. Property value inheritance. Silverlight uses property value inheritance with a small set of control properties, including Foreground, FontFamily, FontSize, FontStretch, FontStyle, and FontWeight. That means if you set these properties in a higher-level container (such as a Button or a ContentControl), they cascade down to the contained content elements (like the TextBlock that actually holds the text inside).
    5. Default value. If no other property setter is at work, the dependency property gets its default value. The default value is set with the PropertyMetadata object when the dependency property is first created, as explained in the previous section.

    One of the advantages of this system is that it’s very economical. For example, if the value of a property has not been set locally, Silverlight will retrieve its value from the template or a style. In this case, no additional memory is required to store the value. Another advantage is that different property providers may override one another, but they don’t overwrite each other. For example, if you set a local value and then trigger an animation, the animation temporarily takes control. However, your local value is retained, and when the animation ends, it comes back into effect.

  • 相关阅读:
    SQL性能--left join和inner join的运行速度与效率
    20分钟搭建selenium+python+pydev+eclipse环境
    python 模拟双色球输出
    python 装饰器
    leetcode python丑数
    leetcode python找不同
    TCP和UDP的区别以及使用python服务端客户端简单编程
    python 上台阶
    leetcode python快乐数
    mysql 两例习题
  • 原文地址:https://www.cnblogs.com/happyframework/p/3289147.html
Copyright © 2011-2022 走看看