WPF Applications, It's all about XAML these days

  • View
    3.169

  • Download
    0

Embed Size (px)

DESCRIPTION

This is a session I delivered at Indy TechFest '08 on Oct. 4, 2008. It serves as an introduction to building Windows Presentation Foundation applications using Visual Studio 2008 and Expression Blend.

Text of WPF Applications, It's all about XAML these days

  • 1. Dave Bost Developer Evangelist http://davebost.com/blog

2.

  • Dave Bost
  • Developer Evangelist
  • [email_address]
  • http://davebost.com/blog
  • http://twitter.com/davebost

3. http://thirstydeveloper.com Looking at someones code, but with audio 4.

  • Create WPF application with
    • Visual Studio 2008
    • Expression Blend
  • A WPF application is managed code
    • It runs on the .NET 2.0 runtime
  • Some classes similar to the WinForms model
    • Application class
    • Has Window class instead of Form class
    • Use .Show() or .ShowDialog to display
    • Page class for forward/back navigation
  • Host WinForms controls on WPF window
  • Host WPF controls on Winform forms

5. 6. Manhattan Associates: Integrated Logistics Solutions (ILS) Supply Chain Optimization Status: ShippingInfo: http://www.manh.com/ils_net/ 7. Zurich Airport Zeus Business monitoring for airport operations Status: Complete Case Study: microsoft.com 8. SilverWare SilverWareAvrio is a powerful hospitality industry solution with a highly intuitive GUI that makes it one of the most accessible P.O.S. solutions that restaurateurs and staff can use. Status: Shipping 9. Entellium Rave CRM software for small and medium businesses Status: Launched 10. Eikos Partners: OpenTickOpentick is an open-source data provider that delivers free real-timeand historical market data for trading systems and trading platforms. Status: Shipping 11. Asahiyama ZooPortal for the virtual exploration of one of Japans largest zoos. Status: ShippingLive Site: http://www.asahiyamazoo-aict.jp/asahiyamazoo.xbap 12. Yahoo Next-generation instant messaging client Status: Public Beta 13. Libronix Notescraps Post-it note software Status: ShippingDownload: http://www.notescraps.com 14. Seattle Post-Intelligencer News Reader Reading experience for Seattle-based newspaper Status: Completed Website: http://seattlepi.nwsource.com 15. OTTO Next-generation retail experience Status: Complete PR:Microsoft PressPass 16. Fujitsu Fujitsu North American Retail released the Global Store product line using WPF as the UI for their point of sales system. Status: Deploying in AMC theaters in May 2008 17. Wells Fargo Next-generation ATM client Status: In deployment to new ATMs across the US 18. British Library Revolutionary new 3D experience for accessing priceless literary treasures Status: Complete 19. Scripps Healthcare Allowing cancer researchers to collaborate in the search for a cure Status: Late Beta (Shown at Windows Vista BV Launch) PR:.NET Developers Journal 20. Electric Rain STANDOUT High-end tool for delivering visually stunning presentations Status: Beta 21. Whether you are designingrich standards-based websites, ultimate experiences on the desktop, or managing digital assets and content,Expression professional design tools give you the flexibility and freedom to bring your vision to reality. 22.

  • Extensive Application Markup Language
  • Toolable, declarative markup
  • Code and content are separate
  • Compatible with Windows Presentation Foundation

OK LightBlue XAML Button b1 = new Button(); b1.Content = "OK"; b1.Background = new SolidColorBrush(Colors.LightBlue); b1.Width = 100; C# Dim b1 As New Button b1.Content = "OK" b1.Background = New _ SolidColorBrush(Colors.LightBlue) b1.Width = 100 VB.NET 23.

    • designers & developers:
    • Speakthe samelanguage

designers design

    • designers & developers:
    • Speak different languages

developers add business logic The new way for designers and developers to work together designer developer 24. 25.

  • WPF includes a flexible, panel based layout engine
  • What is layout?
    • Measuring and arranging a region of WPF UI
    • All layout is handled by panels
    • Panel has ultimate control over every child
      • Child size, location, ZOrder
      • Child location relative to other children
  • Frees you from hard coding sizes/locations
    • Mix and combine panels

26. 27. 28. 29. 30. by lee.mccain.photorama http://flickr.com/photos/mccain007/2218878568/ 31. by thomas hawk http://flickr.com/photos/thomashawk/379282442 32. 33.

  • Styles provide a convenient way to itemize a set of property values for an element type
    • Example: Set font attributes for all textboxes
  • To define a Style
    • Styles are defined in a Resource element
    • Any element in XAML can have a resource section
    • Usual locations are Page, Window and Application level
    • Every Style in resource must have a x:Key value
    • Use TargetType to limit style to one element type

34.

  • To apply a Style to an Element
    • Reference the Style by setting the Style attribute
    • Use the Markup Extension syntax '{}'

35. Data Binding & Templates 36.

  • Binding overview
    • WPF synchronizes a data source and data target
    • Add binding to target element with {Binding ***}
  • Change notification
    • WPF dependency system updates target upon source changes provided:
      • Source must implement change notification
      • Via IPropertyNotifyChanged and other mechanisms
  • Single binding
    • Bind a target to a single property on source
    • Example:TextBlock.Text to Customer.Age
  • List binding
    • Bind a target to a array, collection etc.
    • Example:Treeview. ItemsSource to XML source

37.

  • Templates provide a convenient way to centralize the replacement UI for:
    • Tabular data
    • Hierarchical data
    • Controls
  • Data Template
    • Define the UI for one Type
      • Example:Customer class
      • Render UI with six TextBlocks and one Image

38. 39.

  • WPF is a rich UI programming framework
  • Since WPF is managed code, working with .NET APIs is easy and familiar
  • Core concept is the composable UI model
    • Create UI out of any valid WPF element
    • Mix and merge elements
    • Formalize these replacement parts with Styles and Templates

40.

  • Visit MSDN at msdn.microsoft.com
  • Visit the URL below for additionalinformation
  • http://windowsclient.net/
  • Virtual Labs
  • http://msdn.microsoft.com/virtuallabs
  • MIX University
  • http://visitmix.com/university

41. For the latest titles, visit www.microsoft.com/learning/books/devtools 42. These books can be found and purchased at all major book stores and online retailers 43. For training information and availability www.microsoft.com/learning Course ID Title 6460A Windows Presentation Foundation 44.

  • Are you ready to take your career as a developer to the next level?
  • Looking for a learning experience that is designed for you?
  • Join MSDN Ramp Up and Summit Your Career!
  • MSDNRamp Upis your online source that provides free training and technical resources to help take your development skills to the next level.
  • Step-by-Step training plans to build your development skills.
  • Premium technical content created by expert developers for developers.
  • Access to valuable online e-learning, e-references, and virtual labs.
  • 50% discount on select certification exams and 30% discount onMicrosoft Press training kits.
  • Join Ramp Up for free today!
  • Go to: http://msdn.microsoft.com/rampup

45. Dave Bost [email_address] thank you! http://davebost.com http://twitter.com/davebost 46. 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presenta