• 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.

  • 相关阅读:
    [2011Summary Weekly]March.28April.1
    如何对需求分析人员进行考核测试角度
    算法实现三角形式输出C(n,k)
    Scrum 培训系列Scrum on a Page
    [练习]solveMaze
    excel中如何统计条件筛选后的条数
    开发人员绩效考核中"有效"bug数的统计
    Scrum 培训系列Scrum Lifecycle
    IIS6.0日志文件自定义类代码
    IIS6.0日志文件分析代码_3线程读取文件到数据库
  • 原文地址:https://www.cnblogs.com/happyframework/p/3289147.html
Copyright © 2020-2023  润新知