什么是一个依赖属性? [英] What is a dependency property?

查看:128
本文介绍了什么是一个依赖属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是.NET一个依赖属性(尤其是在WPF上下文)。从常规属性的区别是什么?

What is a dependency property in .Net (especially in WPF context). What is the difference from the regular property?

推荐答案

依赖属性是从DependencyObject的派生类的属性,他们是特殊的,而不是简单地使用后备字段来存储他们的价值,他们用一些辅助方法对DependencyObject的。

Dependency properties are properties of classes that derive from DependencyObject, and they're special in that rather than simply using a backing field to store their value, they use some helper methods on DependencyObject.

关于他们的最好的事情是,他们拥有所有的管道的结合内置的数据。如果你绑定的东西给他们,他们就会发生变化时通知它。

The nicest thing about them is that they have all the plumbing for data binding built in. If you bind something to them, they'll notify it when they change.

这篇关于什么是一个依赖属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆