Categories: WPF Posted by mheydt on 11/6/2008 3:34 AM | Comments (0)
This is a list I need to grow over time to answer this question.  Besides the fact of vector based scalable graphics, WPF has the following advantages:

  • Ability to accomplish much of the app in a purely declarative model
  • Ability to very effectively separate UI from logic
  • Dependency property model
  • Command model, including routed commands.
  • Bubbled and tunneled events.  Many times its so much easier to let events bubble up to a unified listener and make a decision on what to do based upon the original source, or the last control to bubble / tunnel the event.  This just lets your centralized a lot of the UI processing logic for a form at the form level, instead of splattered all over the individual controls.
  • Built in animation models, including story boarding
  • Styling and themes
  • Better UI threading model
  • Visual state management.  Yeah, still just in Silverlight, but coming to WPF soon.
  • Declarative model translates to other environments (ie, Silverlight)
  • Databinding is LIGHT YEARS more advanced.  More on this later.
  • Tying into data binding and dependency properties, the observablecollection model is much more robust
  • Data and control templates which provide flexible modeling (and substitution) of UI on data models.
  • User interface virtualization is built in, allowing handling of extremely large data sets
  • 2-Pass layout model.  This is real important is it allows negotiation of layout, and control by the container of other controls to modify positioning of element.
  • Attached property model, which provides great flexibility in allowing a child of a parent element to talk to the parent in its own language, even though the child has no idea what the type of the parent is.  Want to position a text block in a canvas?  Use Canvas.LeftProperty.  Want to position it in a grid column, use Grid.RowProperty.  The child is agnostic to the type of the container, and you make the design time decision on how to pair them up without having to add any code to the child.
  • Declarative triggers.  Just great to be able to trigger declarative code based upon various events with more declarative code.  Much more flexible than doing code behind.
  • 3D (yeah, that's part of the obvious vector graphics)
  • Ability to easily integrate different types of media out of the box
  • Extensive support for different layout models (grid, canvas, stack panel, wrap panel, ...)
  • Ability to create interfaces dynamically, or to download and execute them dynamically
  • Winforms controls can be used via interop in a WPF app (helps support your installed base)
  • Did I say databinding is more advanced?  I just love databinding to XML.  Additionally, combined with Linq and anonymous classes, databinding is just so much more effective and simple to implement.
  • Control creation and reusability.  Actual creation of controls is about as easy, but you can reuse controls in WPF so much more effectively.  Basically any other control can be the content of another control, allowing great flexibility in building UIs.
  • Ability to declaratively use business objects in the UI.  Your programmers can build the business objects, package them in a library, and then you can instantiate instances of them in xaml as resources and bind them directly to controls.  All without and code on the UI side.
  • Preview event model, letting you intercept and perhaps prevent / modify events before they are processed.  Brilliant!
Also, and this is a gut feeling that I find hard to quantify, but it just seems that I am significantly more productive in WPF than in WinForms.  I think this comes from the ability to quickly layout items, get them bound to data, repurpose the UI if needed, all without much code just seems so much more productive.

Sure it took me understanding all of the items above, but once they are understood it's just really a much more productive environment.

Comments