What's new in XAML of .NET 4.0
2010-05-21 06:52
525 查看
With .NET 4.0 Microsoft will bring up a improved version of XAML. This arcitle shows you the language enhancements they made.
代码<!-- XAML 2006 -->
<StreamGeometry x:Key="CheckGeometry">M 0 0 L 12 8 l 9 12 z</StreamGeometry>
<!-- XAML 2009 -->
<StreamGeometry>M 0 0 L 12 8 l 9 12 z
<x:Key><x:Double>10.0</x:Double></x:Key>
</StreamGeometry>
Use of Non-Default Constructors with
In XAML 2006 objects must have a public default constructor to use them. In XAML 2009 you can pass constructor arguments by using the
<!-- XAML 2006 -->
Guid id = Guid.NewGuid();
<!-- XAML 2009 -->
<Guid x:FactoryMethod="Guid.NewGuid" />
Easy Object References with {x:Reference}
If you want to create an object reference today you need to do a databinding and declare the source with an ElementName. In XAML 2009 you can use the new{x:Reference}markup extension
代码<!-- XAML 2006 -->
<StreamGeometry x:Key="CheckGeometry">M 0 0 L 12 8 l 9 12 z</StreamGeometry>
<!-- XAML 2009 -->
<StreamGeometry>M 0 0 L 12 8 l 9 12 z
<x:Key><x:Double>10.0</x:Double></x:Key>
</StreamGeometry>
Use of Non-Default Constructors with x:Arguments
In XAML 2006 objects must have a public default constructor to use them. In XAML 2009 you can pass constructor arguments by using the x:Argumentssyntax.
<!-- XAML 2006 -->
Guid id = Guid.NewGuid();
<!-- XAML 2009 -->
<Guid x:FactoryMethod="Guid.NewGuid" />
相关文章推荐
- .NET 4.0 will come soon, let’s review what is new in .net 3.0
- what’s new in the .NET CLR 4.0/4.5 GC (.NET 4/4.5里新的垃圾收集机制)
- What’s New For Parallelism in .NET 4.5
- What's New in the .NET Framework 2.0 Beta
- 转:What's New in the .NET Framework 4
- What's New in the .NET Framework Version 3.5
- New Features in ASP.NET Ajax 4.0
- An Overview Of The New Services, Controls, And Features In ASP.NET 2.0
- What's New in ASP.NET 2.0?
- What is new in the .net framework 3.5?
- IHttpActionResult – new way of creating responses in ASP.NET Web API 2
- The Big List of What’s New or Improved in Silverlight 5
- What's New in the .NET Framework Version 4
- CLR 4.0 有哪些新东西? What's new in CLR 4.0--类型嵌入 Type embedding
- What's New in the .NET Framework 2.0 Beta
- customize the template of new files in vs.net 2003
- What's New in ASP.NET
- What's New in ASP.NET 2.0?
- What's New in the .NET Framework Version 2.0
- What’s new in Web Intelligence Rich Client in BI 4.0 ?