"Essential WPF - Chapter 6 Data" 阅读笔记

原创 2011年01月20日 09:41:00

Chapter 6 Data

 

在 WPF 中, 数据绑定是一个核心的概念.

 

6.1 Data Principles

 

Most applications are built to display or create some type of data.

 

6.1.1 The .NET Data Model

 

A data model describes the contract between a source of data and the consumer of that data.

说的很玄乎, 但是在这里的意思比较简单, 指的 IEnumerable, Property 之类的数据访问接口

 

Because all of WPF’s data operations are based on the fundamental .NET data model, WPF controls can retrieve data from any CLR object.

这意味着 As long as data can be accessed through the CLR, it can be visualized in WPF.

 

6.1.2 Pervasive Binding

 

Binding works great as a way to keep two objects in sync, but it begins to have problems when the data types of these objects don’t match up perfectly.

Binding 是个比较好用的手段, 因此需要最大化的利用, "Full Exploitation"

To make binding truly pervasive in the framework, it was necessary to provide ways to transform data.

 

6.1.3 Data Transformation

 

WPF supports two main types of transformation: value conversion and data templates.

 

6.2 Resources

 

WPF 里面 Resources 用得还是很多的.

 

The lookup path for resources:

1. Element hierarchy

2. Application.Resources
3. Type theme
4. System theme

 

6.3 Binding Basics

 

Binding is simply keeping two data points in sync with each other.

 

Data point is an abstract concept, the idea of a single “node” of data.

A data point can be described in a variety of ways; generally it is a data source and query. For example, a property data point would be an object and a property name. The property name determines the property on the source object from which data should be retrieved.

 

There are two base mechanisms for value conversion: TypeConverter, which is a base mechanism that has been in .NET since version 1.0; and the new IValueConverter.

 

Data points and transformation are the two fundamental constructs of binding.

 

6.4 Binding to CLR Objects

 

The property name identifier for object binding has two forms: one for simple CLR properties and another for WPF’s DependencyProperty-based properties.

 

This optimization is useful for two reasons: first, to avoid the performance impact of using reflection; and second, to enable binding to attached properties.

 

6.4.1 Editing

 

It is important for
data sources to provide change notification to allow the binding system to respond when the data is modified.

 

To enable our Person object model to support change notification, we have three options: (1) implement  INotifyPropertyChanged, (2) add events that report changes to properties, or (3) create Dependency-Property-based properties.

 

6.5 Binding to XML

略过

 

6.6 Data Templates

 

data templates allow us to define how a piece of data will appear.

 

6.6.1 Template Selection

略过

 

6.7 Advanced Binding

 

6.7.1 Hierarchical Binding

 

HierarchicalDataTemplate 递归绑定树形数据结构的方式比较值得关注

 

6.7.2 Collection Views

略过

 

6.8 Data-Driven Display

 

One of the more powerful things we can do with WPF is to reverse the typical relationship: The data can be the center of an application, and the UI can be secondary.

听起来很好, 不过太极端了, 可能对某些特定场合有用, 但为此增加 WPF 的复杂度值得吗?

"Essential WPF - Chapter 8 Styles" 阅读笔记

Chapter 8 Styles 8.3 Using Styles for Good, Not Evil 8.3.1 Build Themes, Not Styles Consequently, ge...
  • lethwei
  • lethwei
  • 2011年02月10日 15:26
  • 339

"Essential WPF - Chapter 7 Actions" 阅读笔记

Chapter 7 Actions Up to now we have focused on the output side of the platform, looking at how an ap...
  • lethwei
  • lethwei
  • 2011年01月21日 13:10
  • 563

"Essential WPF - Chapter 5 Visuals" 阅读笔记

(WPF 设计师讲述 WPF 框架设计思路的书, 非常不错. 之前看了一半, 一直想要看完, 刚好最近有项目界面决定采用 WPF, 捡起这本书, 继续学习) Chapter 5 Visuals WPF...
  • lethwei
  • lethwei
  • 2011年01月14日 16:27
  • 378

Essential WPF电子表格控件Essential Grid for WPF下载及介绍

Essential Grid for WPF是一款功能强大的表格控件,支持所有标准表格功能,同样还提供了许多特定功能,如虚拟模式、冻结行和列,拖拉操作等。支持多种单元格类型,支持树型表格显示,多种单元...
  • fanganzhuanjia
  • fanganzhuanjia
  • 2014年05月09日 10:45
  • 948

CHAPTER 6 Deep learning

In the last chapter we learned that deep neuralnetworks are often much harder to train than shallo...
  • mydear_11000
  • mydear_11000
  • 2016年04月20日 16:44
  • 646

Java学习笔记(1)Introduction to Computers, Programs, and Java

学习教材为《Introducition to Java Programming》。 Chapter1 Introduction to Computers, Programs, and Java 1...
  • Musetisa
  • Musetisa
  • 2016年06月23日 00:19
  • 550

人脸识别学习笔记(1)

人脸识别学习笔记(1)  1) 相关科学      神经生理学,神经病理学,心理学,脑神经学,计算机视觉。2...
  • hawksoft
  • hawksoft
  • 2017年08月01日 15:00
  • 447

代码阅读和实践笔记

高级c数据类型 C指针 c程序中,指针一般用来: 构造链式数据结构 引用动态分配的数据结构 #define new(type) (type*) calloc(sizeof((type),1)...
  • laoj1228
  • laoj1228
  • 2017年01月14日 22:20
  • 225

essential c++阅读笔记(1)

学习c++的同学很多老师和同学都推荐《c++ primer》这本书,但是这本书有1千多页,知识点特别多,而且不能使初学者很快的上手,在这里我比较推荐《essential c++》这本书。读者使用c++...
  • lemon_wonder
  • lemon_wonder
  • 2013年08月08日 10:46
  • 395

Think Python:Chapter 6: Fruitful Functions 的笔记

这是MIT官方编程教程中Python Tutorial中Functions and Scope的内容。本篇博客为《 Think Python: How to Think Like a Computer...
  • u010546828
  • u010546828
  • 2015年04月21日 18:34
  • 684
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:"Essential WPF - Chapter 6 Data" 阅读笔记
举报原因:
原因补充:

(最多只允许输入30个字)