WPF学习笔记二

来源:互联网 发布:淘宝卖书需要什么证 编辑:程序博客网 时间:2024/04/30 11:52

自划重点:

  • In order to bridge the gap between string values and nonstring properties, the XAML parser needs to perform a conversion. The conversion is performed by type converters, a basic piece of .NET infrastructure that's existed since .NET 1.0.
    为了在字符串属性和非字符串属性间建立起桥梁,XAML解析器需要进行转换。这个转换由类型转换器完成,它是自.NET 1.0以后就有的.NET基础结构的一个基础部分。
  • Reading BAML at runtime is faster than reading XAML.
    运行时读取BAML要比读取XAML快。 
 
注:自划重点部分笔者自行翻译,由于能力有限仅供参考,欢迎批评指正。
 
自我总结:
  • XAML和所有基与XML的语言一样,都是大小写敏感的,而类型转换器并不是大小写敏感的。
  • 特殊的字符和该字符实体:“<”对应“&lt;”、“>”对应“&gt”、“&”对应“&amp;”、“"”对应“&quot;”。
  • WPF程序很灵活,可以像传统WinForm那样只写C# Code,也可以只写XAML(去掉类名,事件处理,把Window改为Page等就可以直接用IE进行浏览,需要.NET Framework 3.0支持),不过更一般的情况是UI用XAML来写,而程式在.cs文件中写,这样前台后台分开更有利于开发人员和设计人员的合作。
  • 我们可以使用自定义的命名空间,这个时候只要在开头声明一下 ,如"xmns:sys="clr-namespace:System,assembly=mscorlib".这样我们就可以这样写了<sys:DateTime>2009/02/20</sys:DateTime>。
 
所遇生词:
  • attach and detach event handlers 
  • somewhat confusingly
  • by leaving out the prefix
  • which makes the markup more concise
  • but the syntax is a bit convoluted.
  • that means you can't substitue <button> for <Button>
  • this sleight of hand works
  • all the white space inside that element is retained
  • would be unbearably tedious
  • make a change that would be awkward to accomplish in the designer

     

 
 
written by Kim 2/20/2009
查看更多原创技术文章/项目源码/视频教程
欢迎访问       http://www.bosnma.com
原创粉丝点击