Introduction To Wpf Engines

839 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
839
On SlideShare
0
From Embeds
0
Number of Embeds
29
Actions
Shares
0
Downloads
42
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction To Wpf Engines

  1. 1. Tamir Khason Software consulter mPrest systems [email_address] http://blogs.microsoft.co.il/blogs/tamir 06/07/09 © 2001-2007 Copyright Microsoft corporation
  2. 2. Agenda <ul><li>WTF 1 is WPF </li></ul><ul><li>WTF 2 Inside there </li></ul><ul><li>WTF 3 XAML </li></ul><ul><li>WTF 4 WPF Engines </li></ul><ul><li>WTF 5 Expression </li></ul>1 - Work Time Fun 2 - Write To File 3 - What's This For 4 - Words That Follow 5 - Way to Fly
  3. 3. Windows Presentation Foundation <ul><li>WPF is much richer then WinForms </li></ul><ul><li>XAML is cool and prevents the mess with crazy designers </li></ul><ul><li>We do not really need User Controls and Owner Draws </li></ul><ul><li>We can forget about input and output hardware </li></ul><ul><li>We want all properties to be DPs and all events to be REs </li></ul><ul><li>It’s all about data </li></ul>
  4. 4. <ul><li>No demos – don’t you already use it in your developments? </li></ul>
  5. 5. Platforms? Windows XP Home/Pro SP2 Windows Server 2003 Windows Vista
  6. 6. What about all things done? <ul><li>Can use WPF with existing code </li></ul><ul><ul><li>WPF inside existing code </li></ul></ul><ul><ul><li>Existing code inside WPF </li></ul></ul><ul><li>Interop at the component level </li></ul><ul><li>Maximum richness => all WPF </li></ul>
  7. 7. <ul><li>Engines involved </li></ul>WTF 2 Inside there
  8. 8. How to design your application <ul><li>WPF controls are lookless – it’s all about data </li></ul><ul><li>Objects creation through properties drives behaviors </li></ul><ul><li>WPF is dynamic, sometimes too much </li></ul><ul><li>First create data, then let designer to present it </li></ul>
  9. 9. WPF fundamentals <ul><li>Basic Architecture </li></ul><ul><li>XAML </li></ul><ul><li>Layout </li></ul><ul><li>Controls </li></ul>
  10. 10. Content model <ul><li>There are only two framework elements: </li></ul><ul><ul><li>Content and Behavior </li></ul></ul><ul><ul><li>Containers of Content and Behavior </li></ul></ul><ul><li>Content element contains any kind of content via Content property </li></ul><ul><li>Item element contains any number of Content Elements via Items property and pointer to current element </li></ul>
  11. 11. Layout model <ul><li>WPF has only one panel, but different behaviors for this one </li></ul><ul><li>Panel behavior is an implementation a control layout </li></ul><ul><li>You have some ready made and can create your own </li></ul><ul><li>There are some layout models </li></ul><ul><ul><li>Children, Size to Content, Alignments, Margins and Overflows </li></ul></ul>
  12. 12. Layout - Panels
  13. 13. Dependency Property <ul><li>Calculating of property's value based on other properties </li></ul><ul><li>Dependency property is… </li></ul><ul><ul><li>Static fields, registered with meta data </li></ul></ul><ul><ul><li>CLR property </li></ul></ul><ul><li>Attached property is a dependency property that defined by a different type than the element to which the property is applied </li></ul>
  14. 14. <ul><li>eXtensible Application Markup Language </li></ul>WTF 3 XAML
  15. 15. XAML defines a tree of stateful objects <ul><li><TravelItenerary> </li></ul><ul><li><CarTrip </li></ul><ul><li>From=&quot;Aix en Provence, France&quot; To=&quot;Paris, France&quot; </li></ul><ul><li>Time=&quot;2006/07/20T12:00&quot; </li></ul><ul><li>Duration=&quot;6:00:00&quot; /> </li></ul><ul><li><Hotel </li></ul><ul><li>Name=&quot;Under the Eiffel Tower&quot; </li></ul><ul><li>Location=&quot;Paris, France&quot; </li></ul><ul><li>Time=&quot;2006/07/20T20:00&quot; </li></ul><ul><li>CheckOut=&quot;2006/07/21T05:00&quot; /> </li></ul><ul><li><Flight </li></ul><ul><li>From=&quot;Paris, France&quot; To=&quot;London, England&quot; </li></ul><ul><li>Time=&quot;2006/07/21T7:00&quot; </li></ul><ul><li>Duration=&quot;1:15:00&quot; /> </li></ul><ul><li><Flight </li></ul><ul><li>From=&quot;London, England&quot; </li></ul><ul><li>To=&quot;Seattle, USA&quot; </li></ul><ul><li>Time=&quot;2006/07/21T16:15&quot; </li></ul><ul><li>Duration=&quot;9:30:00&quot; /> </li></ul><ul><li></TravelItenerary> </li></ul>
  16. 16. XAML uses namespaces for extensions - xmlns:… <ul><li>Markup Extensions </li></ul><ul><ul><li>Used in Attribute Values to set values that aren't settable via type converters </li></ul></ul><ul><ul><li>XAML Language </li></ul></ul><ul><ul><ul><li>{x:Null} </li></ul></ul></ul><ul><ul><ul><li>{x:Static Class.Member} </li></ul></ul></ul><ul><ul><ul><li>{x:Type wpf:Button} </li></ul></ul></ul><ul><ul><li>WPF Class Library </li></ul></ul><ul><ul><ul><li>{Binding …}, {StaticResource …}, {DynamicResource …}, etc… </li></ul></ul></ul>
  17. 17. <ul><li>How they make our live easier? </li></ul>WTF 4 WPF Engines
  18. 18. Routed Events <ul><li>Nothing new, but nice refreshment – regular .NET events extension </li></ul><ul><li>Can be created, changed and called </li></ul><ul><li>Can have one of following strategies </li></ul><ul><ul><li>Direct </li></ul></ul><ul><ul><li>Bubbling </li></ul></ul><ul><ul><li>Tunneling </li></ul></ul>
  19. 19. Commands <ul><li>Command = Action </li></ul><ul><li>Command != Action logic </li></ul><ul><li>Can be executed from different places </li></ul><ul><li>Can have different behaviors for different targets </li></ul><ul><li>You have some ready made and can create your own </li></ul><ul><li>Can have constraints </li></ul>
  20. 20. Data Binding <ul><li>WPF understands your data </li></ul><ul><ul><li>use your favorite data model: XML, objects, SQL, WS … </li></ul></ul><ul><ul><li>Bind data to controls </li></ul></ul><ul><li>Templates give your data a face </li></ul><ul><li>Controls “think” data </li></ul><ul><ul><li>Data is pervasive across and integrated into the platform </li></ul></ul>
  21. 21. Data Binding <ul><li>Target </li></ul><ul><ul><li>Any property, any element </li></ul></ul><ul><li>Source </li></ul><ul><ul><li>CLR Object </li></ul></ul><ul><ul><li>WPF Element </li></ul></ul><ul><ul><li>ADO.NET </li></ul></ul><ul><ul><li>XML </li></ul></ul><ul><li>Dynamic </li></ul><ul><ul><li>INotifyPropertyChanged, DependencyProperty or PropertyDescriptor </li></ul></ul><ul><li>Multiple models </li></ul><ul><ul><li>One Time </li></ul></ul><ul><ul><li>One Way </li></ul></ul><ul><ul><li>Two Way </li></ul></ul><ul><li>Value Converter </li></ul>Control “ Data Item” Property Property Binding
  22. 22. Styles <ul><li>A style is a way to change visual representation of control, by using a set of properties </li></ul><ul><li>Styles make your application to looks fun, without changing its logic </li></ul><ul><li>The separation of the presentation and logic allows designers and programmers to work simultaneously </li></ul>
  23. 23. Templates <ul><li>Templates are not styles, but might include </li></ul><ul><li>Templates is the way to change control’s behaviors </li></ul><ul><li>Templates is the way to change data representation </li></ul><ul><li>Templates are resources, thus might be loaded externally </li></ul>
  24. 24. Control Templates <ul><li>Controls have separated appearance and behavior </li></ul><ul><li>Control template = way to change behavior </li></ul><ul><li>Control appearance is the Cheshire Cat and set by styles   </li></ul><ul><li>You do not need custom controls, unless you have something new to do </li></ul>
  25. 25. Data Templates <ul><li>Make you data visible </li></ul><ul><li>Data Template is the way to definevisual structure of a data object </li></ul><ul><li>Data Template useable aside with binding </li></ul><ul><li>Don’t build views for displaying data, let the data to build the view </li></ul><ul><li>Might be recursive </li></ul>
  26. 26. <ul><li>What’s going on over designer’s scheme? </li></ul>WTF 5 Expression
  27. 27. Expression Blend <ul><li>Expression Blend is a design tool </li></ul><ul><li>Expression Blend provides tools for </li></ul><ul><ul><li>Vector and bitmap based graphics </li></ul></ul><ul><ul><li>3D, Animation </li></ul></ul><ul><ul><li>Rich Controls, Text Documents and more. </li></ul></ul><ul><li>Share results with Developers who use Visual Studio to add C# or VB code and assemble the final experience. </li></ul>
  28. 29. Expression Design <ul><li>Expression Design is even more design tool </li></ul><ul><li>Expression Design provides tools for </li></ul><ul><ul><li>Professional and highly creative vector drawing </li></ul></ul><ul><ul><li>Transformation and effect features </li></ul></ul><ul><ul><li>An reliable XAML Exporter to convert design elements into XAML </li></ul></ul><ul><li>Share results with Designer who use Expression Blend to add elements into layout and final markup </li></ul>
  29. 31. Expression Media and Web <ul><li>Expression Web </li></ul><ul><ul><li>Build websites using XHTML, ASP.NET, CSS, XML, etc. </li></ul></ul><ul><li>Expression Media </li></ul><ul><ul><li>Digital Asset Management and Cataloguing tool for arrangement of large amount of rich media types into logical categories. </li></ul></ul><ul><li>Expression Studio contains of them all </li></ul>
  30. 32. WTF n - Where's the Food?
  31. 33. © 2006 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 presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 06/07/09 © 2001-2007 Copyright Microsoft corporation

×