#158 – When to Create a Custom Dependency Property(哪些情况要创建自定义依赖属性)
来源:互联网 发布:linux rhel6 root密码 编辑:程序博客网 时间:2024/05/23 22:01
原文地址:
https://wpf.2000things.com/2010/12/17/158-when-to-create-a-custom-dependency-property/
当你创建一个类,并未其创建属性的时候,你需要确定是否将它创建为完全的WPF依赖属性。
如果某个属性是标准的CLR属性,而非依赖属性,你依然可以在XAML中设置它的值。
但是在下面这些情况下,你可能需要自定义依赖属性:
-通过style为属性赋值
-在属性上使用数据绑定
-使用DynamicResource为属性赋值
-通过继承获得属性的值
-使用动画获得属性的值
-使用 PropertyChanged, CoerceValue or ValidateValue 等回调方法
-想在Visual Studio 或者 Blend designers支持该属性
0 0
- #158 – When to Create a Custom Dependency Property(哪些情况要创建自定义依赖属性)
- #159 – Creating a Read-Only Dependency Property(创建一个只读的依赖属性)
- #122 – Validating a Dependency Property(验证依赖属性)
- #128 – Using Code Snippets to Implement a Dependency Property(用代码段实现依赖属性)
- Dependency Property 依赖属性
- 依赖属性Dependency Property
- #117 – Registering a Dependency Property(注册一个依赖属性)
- #120 – Clearing a Dependency Property Value(清除依赖属性的值)
- #123 – Coercing a Dependency Property(强制转换依赖属性的值)
- WPF中的依赖属性(Dependency Property)
- #121 – Being Notified When the Value of a Dependency Property Changes(属性值改变通知)
- #167 – Implementing a Dependency Property That Is A Collection(实现一个Collection类型的依赖属性)
- Silverlight:Dependency Property(依赖属性)
- #147 – Use SetCurrentValue When You Want to Set A Dependency Property Value from Within a Control
- 依赖属性 dependency property WPF,为什么要用DDP?
- #154 – Reusing an Existing Dependency Property in Your Class(重用依赖属性)
- Silverlight:Dependency Property(依赖属性)学习笔记
- Silverlight:Dependency Property(依赖属性)学习笔记
- Database.NET多数据库管理工具
- 手写rootViewController
- 爱客猴内容管理系统v3.2.3新增程序安装功能
- 子查询返回的值不止一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,关于触发器SQL语句,完美解决
- 设置UITextField的placeholder的颜色代码片段:
- #158 – When to Create a Custom Dependency Property(哪些情况要创建自定义依赖属性)
- php://input、$_POST与$GLOBALS['HTTP_RAW_POST_DATA']三者的区别
- 在线破解idea,一键破解idea,url破解idea
- 音频流的蓝牙传输
- FRAM(铁电存储器)
- Postgres常用查询语句
- ios 多线程之GCD
- 如何使用js将canvas保存为图片文件,并且可以自定义文件名
- lightOJ1032(数位dp)