2. Agenda
Intro
Why WPF?
Tools (MS Expression, MS Blend, MS Design)
XAML
Concepts:
Logical and visual tree + Demo
Dependency properties + Demo
Layout and panels + Demo
Discussions:
Tools and Toolkits
Silverlight vs WPF
Silverlight power
Questions
3. Why WPF?
Broad integration
(3D/2D/video/speech/rich document)
Resolution independence
Hardware acceleration
(It is built on top of Direct3D)
Declarative programming
(Extensible Application Markup Language - XAML)
Rich composition and customization
Easy deployment
(ClickOnce, Silverlight)
4. Why WPF? - The real reason
Vanity Kodak
1928
iPod Mini
2003
Return on Experience – By Design
6. XAML
XAML is a new Extensible Application Markup Language
and is important in integrating graphic designers into the
development process but not only.
Futures:
Most concise way to represent user interfaces or other
hierarchies of objects
Encourages a separation of logic layer from the presentation
layer
The commune language that almost all WPF-related tools
use and understand
XML-based language
8. Concepts - Logical and visual
tree
User interface because of its hierarchical nature in
WPF is constructed from tree elements of objects
known as a logical tree elements.
Window element is the root of logical tree.
Every aspect of WPF (properties, events, resources,
and so on) is tied to the logical tree.
A visual tree is basically an expansion of a
logical tree, in which nodes are broken down into
their core visual components.
9. Tools for investigation
Snoop Mole
Little project is Snoop, a Spy++ like Mole is a Visual Studio visualizer.
utility for WPF applications, but cooler. Visualizers have been part of Visual
Studio since version 2005.
Futures:
Browse the visual tree of running Futures:
WPF applications. Lightning fast performance is
Inspect properties of elements at realized by using a multi-
runtime. threaded, lazy-loaded
Edit properties of elements at architecture for passing data
runtime. between processes.
Inspect RoutedEvents that are View application UI elements in a
occurring, including the elements TreeView control.
that handle them. Editing of properties in all project
Magnify sections of the UI. types
Find and debug binding errors. Multi-level drilling into objects and
child objects, viewing any of their
data.
http://blois.us/Snoop/ http://karlshifflett.wordpress.
com/mole-for-visual-studio/
11. Concepts - Dependency
properties
A new type of property called a dependency
property.
Futures:
Change notification
Property value inheritance
Support for multiple providers
XAML
Button has 96 public properties
12. Concepts - Dependency
properties
Evaluate multiple providers:
Attached Properties:
An attached property is a special form of dependency
property that can effectively be attached to arbitrary
objects.
14. Concepts - Layout and panels
Freezable—The base class for objects that
can be “frozen” into a read-only state for
performance reasons.
Visual—The base class for all objects that
have their own visual representation.
UIElement—The base class for all visual
objects with support for routed events,
command binding, layout, and focus.
ContentElement
A base class similar to UIElement,
but for pieces of content that
don’t have rendering
behavior on their own.
15. Concepts - Layout and panels
Sizing, Positioning (HTML-CSS || XAML)
Layout:
Canvas
StackPanel
WrapPanel
DockPanel
Grid
(Visual Studio and Expression Blend use
Grid by default for their projects)
17. Tools and Toolkits
WFP Toolkit – June 2009
The WPF Toolkit is collection of WPF features and components that are being made
available outside of the normal .NET Framework ship cycle
http://www.codeplex.com/wpf
Components in the Stable Quality Band
DataGrid
DatePicker
Calendar
VisualStateManager
Components in the Preview Quality Band
Chart Controls
Silverlight Toolkit (Silverlight 2&3) – July 2009
The Silverlight Toolkit is a collection of Silverlight controls, components and utilities made
available outside the normal Silverlight release cycle.
http://www.codeplex.com/Silverlight
18. Silverlight vs WPF
Main differences:
No full keyboard and mouse events support
Only WCF BasicHttpBinding and
PollingDuplexHttpBinding in Silverlight
Silverlight can only make asynchronous network
calls
Limited collections and generic in Silverlight
Download: [2MB – PDF]
http://wpfslguidance.codeplex.com/