第1章 为什么创造WPF、第2章 XAML揭秘

1.2 步入WPF

下面是WPF的一些亮点:

广泛整合:各种媒体类型都能组合起来并一起呈现

与分辨率无关:因为WPF使用矢量图形

硬件加速:WPF是基于Direct3D创建的,工作全部是由GPU完成的

声明式编程

富创作和定制

易于部署

2.1 XAML 定义

XAML是一种相对简单、通用的声明式编程语言

XAML由一些规则(告诉解析器和编译器如何处理XML)和一些关键字组成

2.2 元素和特性

2.3 命名空间

XML命名空间

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 http://schemas.microsoft.com/winfx/2006/xaml/presentation 相当于.NET命名空间 System.Windows  System.Windows.Controls 等

2.4属性元素

<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             Content="OK" >
</Button>

等价于

<Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
       <Button.Content> OK </Button.Content>
</Button>

2.5 类型转换器

原文地址:https://www.cnblogs.com/code1992/p/10063617.html