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.

  • 相关阅读:
    Linux 分区注意事项
    wamp2.4-- 为WAMP中的mysql设置密码密码
    转multicast vs broadcast
    转 生成 HTMLTestRunner 测试报告
    Eclipse和PyDev搭建完美Python开发环境(Windows篇)
    转 深入解析浏览器的幕后工作原理
    selenium + python 怎样才能滚到页面的底部?
    Java ZIP压缩和解压缩文件(解决中文文件名乱码问题)
    Java中使用poi导入、导出Excel
    eclipse下的tomcat内存设置大小
  • 原文地址:https://www.cnblogs.com/happyframework/p/3289147.html
Copyright © 2011-2022 走看看