[WPF] WPF 4.5 New Features

好久没有来了。看了个微软介绍WPF 4.5 新特性的视频。在这里连同自己理解的部分Memo一下,可能有些地方理解不正确,希望谅解~ 

ps. 发现自己博客里面各种技术杂项都有。。汗。。-_-b

New Features of WPF 4.5

  • Conditional compile
  • PCL - portable class library 
    • support for many platforms (Desktop / Silverlight / Xbox / Windows app store .etc)
  • async and await
    • async fucntion has await sentances (call)
    • normal function has corresponding await function which could be called from client .
    • -> especially useful for web application
    • -> service has a function and generate 1.task 2.async operation (Through dialogue tool)
  • New binding expression
    • binding to static properties
  • Binding delay -> slide do not fire value change event until it's stable
  • Live shaping of collections -> 可以针对某一个field排序
    • e.g ListCollectionView - class

 

viewObject = new ListCollectionView(AAA) // here AAA is ObservableCollection
viewObject.SortDescriptions.Add
viewObject.LiveSortingProerties.Add("Values")
viewObject.IsLiveSorting = true;
  •  Virtualizing panel support for pixel scrolling
    • a large dataset to show - have to use virtualizing and use cache and cache item (page or item)
    • Listbox has properties : VirtualizingPanel.ScrollUnit(Item/Pixel) / CacheLength / CacheLengthUnit(Page)
    • Here “pixel” is new   -> 也就是拉动滚动条的时候, listbox是以pixel为单位滚动。
  • Event weak references  -> 貌似可以自动release eventhandler
    • Built-in support for the weak event pattern
    • Use when listener donesn't know when to unhook event handler
    • Helps avoid memory leaks
    • Generic WeakEventManager
  • Accessing collections on non-UI threads  -> 在非UI线程中也可以动态同步更新collection
    • BindingOperations.EnableCollectionSyncronization(AAA, lock) ; => AAA is ObservableCollection, lock is an object of Object class
  • Others:
    • built-in ribbon and ribbon window
    • INotifyDataErrorInfo
    • ICustomTypeProvider
posted @ 2012-11-15 11:49  JimmyQi  阅读(532)  评论(0编辑  收藏  举报