DependencyProperty and DependencyObject is the core of WPF data binding.

We can use this two class to binding one class instead of using INotifyPropertyChanged

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.ComponentModel;
 using System.Windows;
 using System.Windows.Data;

 namespace WpfApplication1
 {
     class Student : DependencyObject
     {
         public static readonly DependencyProperty NameProperty = DependencyProperty.Register("Name", typeof(string), typeof(Student));

         public string Name
         {
             get { return (string)GetValue(NameProperty); }
             set { SetValue(NameProperty, value); }
         }        

         //public BindingExpressionBase SetBinding(DependencyProperty dp, BindingBase binding)
         //{
         //    return BindingOperations.SetBinding(this, dp, binding);
         //}
     }
 }

while the other part can be the same as the code in ".NET WPF DataBinding".

In ease, we can key "propdp" and Tab key to edit every parameter in the function instead of key all the characters for the function.

Besides, there is one concept called Attached Properties that can attach new properties to existing class. This part can be referenced to the book

.NET: WPF DependencyProperty的更多相关文章

  1. wpf “{DependencyProperty.UnsetValue}”不是属性“Background”的有效值。异常

    , 在wpf模板中, 有一个Background绑定的值不存在导致的异常, 我的是有这个没有导致的错误,  自己添加之后就没有了

  2. WPF中监视DependencyProperty的变化

    WPF中监视DependencyProperty的变化   周银辉 尽管一个类会提供很多事件,但有时候还是显得不够,比如说前两天我就以为WPF的ListBox控件会有ItemsSourceChange ...

  3. WPF依赖属性DependencyProperty

    写在之前: 依赖属性算是WPF醉醉基础的一个组成了.平时写代码的时候,简单的绑定很轻松,但是遇到复杂的层次比较多的绑定,真的是要命.所以,我觉得深刻认识依赖属性是很有必要的.本篇只是个人学习的记录,学 ...

  4. WPF中的DependencyProperty存储方式详解

    前言 接触WPF有一段时间了,之前虽然也经常使用,但是对于DependencyProperty一直处于一知半解的状态.今天花了整整一下午将这个概念梳理了一下,自觉对这个概念有了较为清晰的认识,之前很多 ...

  5. WPF 依赖属性源码 洞察微软如何实现DependencyProperty

    依赖属性DependencyProperty是wpf最重要的一个类,理解该类如何实现对学习wpf帮助很大! 终于找到了该类的源码!仔细阅读源码,看看微软如何玩的花招! File: Base\Syste ...

  6. WPF基础学习笔记整理 (五) DependencyObject & DependencyProperty

    参考资料: 1.http://www.cnblogs.com/Zhouyongh/archive/2009/10/20/1586278.html 基础知识: DependencyObject & ...

  7. WPF中DependencyObject与DependencyProperty的源代码简单剖析

    Windbg调试WPF的依赖属性中提到了wpf的DependencyObject中DependencyProperty是怎样调试查看的. 从中我们看出DO(DependencyObject)与 DP( ...

  8. WPF 使用依赖属性(DependencyProperty) 定义用户控件中的Image Source属性

    原文:WPF 使用依赖属性(DependencyProperty) 定义用户控件中的Image Source属性 如果你要自定义一个图片按钮控件,那么如何在主窗体绑定这个控件上图片的Source呢? ...

  9. 如何在wpf程序中使用DependencyProperty

    作为例子,我决定定义一个MyBorderEx,在WPF常用的"Border"控件中创建一个名为Transparency的属性,来指示它的透明度,这个属性值在0-255间变化,255 ...

随机推荐

  1. 【转】Java 5种字符串拼接方式性能比较。

    最近写一个东东,可能会考虑到字符串拼接,想了几种方法,但对性能未知,于是用Junit写了个单元测试. 代码如下: import java.util.ArrayList; import java.uti ...

  2. freemarker 自定义标签

    1.编写标签类 package com.pccw.business.fnd.common.filegen; import java.io.IOException; import java.io.Wri ...

  3. java Semaphore

    //Listing 6-4. Using a Counting Semaphore to Control Access to a Pool of Items import java.util.conc ...

  4. Xlib 窗口属性

    Xlib 窗口属性 转, 无法找到原作者 所有的 InputOutput 窗口都可以有零个或者多个像素的边框宽度,一个可选的背景,一个事件压制掩码(它压制来自孩子的事件传播),和一个 property ...

  5. .Net 2.0自带的Json序列化、反序列化方法

    public class JsonUtil    {        public static T DeserializeObject<T>(string json)        {   ...

  6. PHP 日期比较

    $temptime = mktime(8,2,12,4,4,2014);$dt1 = date("Y-m-d",time());$dt2 = date("Y-m-d&qu ...

  7. [LeetCode]题解(python):104 Maximum Depth of Binary Tree

    题目来源 https://leetcode.com/problems/maximum-depth-of-binary-tree/ Given a binary tree, find its maxim ...

  8. UILabel 添加图片

    //设置显示图片 NSMutableAttributedString * cellAttributeStr = [[NSMutableAttributedString alloc]initWithSt ...

  9. CDN的原理以及其中的一些技术

    本质:DNS解析CNAME时最终会请求到阿里CDN的DNS服务器上,阿里CDN的DNS服务器会判断请求ip的物理区域是哪里,同时根据各CDN节点的压力做全局的负载均衡 返回合适CDN节点的ip. ht ...

  10. yum报错: Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

    在Centos 5.x或6.x上安装RHEL EPEL Repo repository,资源库,源的意思.RHEL EPEL(Extra Packages for Enterprise Linux)  ...