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. 取url的键值对,location的search:从?开始的字符串

    function urlArgs(){ var args=""; var query=location.search.substring(1);//去除问号 var pairs=q ...

  2. centos的vi常用用法

    centos的vi常用用法 vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令.由于对Unix及Linux系统的 ...

  3. 自己写的一个DirectUI库,基础控件基本都已实现

    http://download.csdn.net/detail/pcradio/9254881 http://blog.csdn.net/pcradio

  4. IE下载时提示无法下载,重试后成功

    // Add Excel as content type and attachment  Response.ContentType = “application/vnd.ms-excel”;  Res ...

  5. angularJS平行控制器间共享数据

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  6. background:transparent的作用

    background的属性值 background : background-color | background-image | background-repeat | background-att ...

  7. java不常用语法汇总(jdk1.6)

    1.浮点数省略的0 System.out.println(.5f); //.5和0.5等价. 2.import static引入一个static method后,可以在这个类中直接使用这个method ...

  8. Anacodna之conda与 virtualenv对比使用教程,创建虚拟环境

    conda创建虚拟环境 1.查看包 conda list查看安装了哪些包 conda env list查看有哪些虚拟环境 conda -V查看conda的版本 2.创建虚拟环境,命名为myflaska ...

  9. [LeetCode]题解(python):80-Remove Duplicates from Sorted Array II

    题目来源 https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ Follow up for "Remov ...

  10. 运用SET ANSI_PADDING OFF创建某个字段为自增列的表,以及插入数据

    SET ANSI_PADDING OFFGOPRINT 'Testing with ANSI_PADDING OFF'GO CREATE TABLE WebsitesPaddingOFF (id in ...