Windows Presentation Foundation

1,251 views

Published on

Windows Presentation Foundation by Pham Phuong Nguyen
HCMC Open University 2009

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
1,251
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
32
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Windows Presentation Foundation

  1. 1. Windows Presentation Foundation<br />Live Club OU<br />PhạmPhương Nguyên<br />Microsoft Student Partner<br />Pham.Nguyen@hotmail.com<br />phamnguyenit.wordpress.com<br />
  2. 2. Agenda<br />Overview WPF<br />1<br />WPF4 - Lots of Good Stuff<br />2<br />Controls in WPF<br />3<br />Question ????<br />4<br />
  3. 3. .Net Framework<br />Data<br />Presentation<br />Communications<br />Workflow<br />Web<br />Base Class Library<br />.NET Framework 4<br />Common Language Runtime<br />
  4. 4. .Net Framework<br />Data<br />Presentation<br />Communications<br />Workflow<br />Web<br />Base Class Library<br />.NET Framework 4<br />Common Language Runtime<br />
  5. 5. Over View<br />?<br />?<br />?<br />Why ?????<br />what ?????<br />Problem ?????<br />?<br />?<br />?<br />
  6. 6. Resolve the problem<br />
  7. 7. demo <br />WikipediaExlorer<br />
  8. 8. What is WPF?<br /><ul><li>WPF – Windows Presentation Foundation</li></ul>Mộtthưviệnthốngnhấtdànhchoviệcxâydựngcácứngdụngtrênnền Windows (kểcảtrênnền Web).<br /><ul><li>UI
  9. 9. Documents
  10. 10. Media
  11. 11. Graphics</li></ul>….<br /><ul><li>Declarative programming</li></li></ul><li>What is WPF?<br />
  12. 12. Why WPF?<br />MFC<br />ALT<br />?<br />WPF<br />GDI+<br />DirectX<br />MPlayer<br />OpenGL<br />Flash<br />HTML<br />
  13. 13. Why WPF?<br />Designer<br />Look, behavior, brand,and emotional connection<br />Developer<br />Function, deployment, data,security, operational integrity<br />
  14. 14. How WPF?<br />XAML<br />Designer<br />Look, behavior, brand,and emotional connection<br />Developer<br />Function, deployment, data,security, operational integrity<br />
  15. 15. How WPF?<br /><Button Width="100">OK<br /> <Button.Background><br />LightBlue<br /> </Button.Background><br /></Button><br />Button b1 = new Button();<br />b1.Content = "OK";<br />b1.Background = newSolidColorBrush (Colors.LightBlue);<br />b1.Width = 100;<br />Dim b1 As New Button<br />b1.Content = "OK"<br />b1.Background = New _SolidColorBrush _ (Colors.LightBlue)<br />b1.Width = 100<br />XAML làgì?<br />XAML == “Extensible Application Markup Language”<br />Ngônngữđánhdấucócấutrúc XML đểxâydựngứngdụng, cácthànhphầncủaứngdụng.<br />Mã XAML và source code hoàntoàn “độclập” nhau<br />
  16. 16. How WPF?<br />Tốithiểu .NET Framework 3.0<br />Visual Studio 2008 hoặccaohơn<br />Expression Blend<br />
  17. 17. Cácthànhphần UI trong WPF<br />Layouts<br />Controls<br />Label, TextBox, Buttons, ComboBox, ProgressBar, …<br />
  18. 18. Windows Presentation Foundation<br />Live Club OU<br />WPF 4.0 - Lots of Good Stuff<br />PhạmPhương Nguyên<br />Microsoft Student Partner<br />Pham.Nguyen@hotmail.com<br />phamnguyenit.wordpress.com<br />
  19. 19. Lots of Good Stuff<br />www.themegallery.com<br /><ul><li>Client Profile
  20. 20. Data controls
  21. 21. Accessibility Improvements
  22. 22. Chart Controls
  23. 23. Control Themes
  24. 24. Hundreds of good bug fixes…
  25. 25. Plus all the goodness of .NET4!
  26. 26. Dynamic Language Support
  27. 27. MEF
  28. 28. Globalization and NLS improvements
  29. 29. Managed / Native Code interop
  30. 30. More…
  31. 31. Cached compositions
  32. 32. Text clarity
  33. 33. Layout Rounding
  34. 34. ClickOnce improvements
  35. 35. Multitouch
  36. 36. Win7 Taskbar
  37. 37. Win7 Ribbon
  38. 38. Focus mgt improvements
  39. 39. Support for UIAccessible2
  40. 40. VSM integration
  41. 41. Full Trust XBaps
  42. 42. PS 3</li></li></ul><li>WPF4<br />Windows 7<br />Fundamentals<br />Features for larger apps (like VS…)<br />Tooling and workflow<br />
  43. 43. WPF for Windows 7 <br />Multi-Touch<br />Taskbar<br />Ribbon<br />Common dialogs<br />File Explorer presence and customization<br />More…<br />Use these with .NET and via XAML in WPF<br />
  44. 44. Multi-Touch in WPF <br />UIElement changes<br />Thao tác các sự kiện (theo dõi và thông dịch viên)hệ thống cảm ứng cử chỉ các sự kiện (double-tap và rollover)Raw touch input events (for going to the metal)<br />Multi-touch support in controls<br />ScrollViewer cập nhật để chấp nhận những cử chỉ panCập nhật cơ sở kiểm soát được cảm ứng đa nhận thứcMulti-capture support (for more than one contact point at time)<br />New multi-touch specific controls (e.g. ScatterView)<br />Compatible with Surface SDK 2.0<br />
  45. 45. Touch Development Roadmap<br />NET 4.0 / Surface 2.0 Release<br />Windows 7 Release<br />Native<br />Win32<br />Application<br />WinFormsApplication<br />WPF Application<br />Surface Application<br />Surface SDK<br />1.0<br />Surface SDK 2.0<br />Multi-Touch Controls<br />Surface <br />Multi-Touch Controls & API<br />Multi-Touch API<br />WPF 3.5 SP1<br />WPF 4.0<br />WPF 3.5<br />Managed Wrapper and Interop<br />Managed Wrapper and Interop<br />Multi-Touch API and Controls<br />Surface Hardware<br />Windows 7<br />Surface Hardware<br />Windows Vista<br />Windows 7<br />Multi-Touch API<br />
  46. 46. demo <br />Multi-TouchDemo<br />
  47. 47. WPF Taskbar Integration<br />Thumbnails toolbars <br />Icon overlays <br />Progress bars <br />Jumplists<br />With XAML Support<br />
  48. 48. WPF Ribbon<br />Features<br />Fulfills office fluent UI licensing requirements<br />Ribbon with resizing and layout behavior<br />Ribbontabs<br />Ribbongroups<br />Ribbonapplicationmenu (Pearl)<br />Quickaccesstoolbar<br />Keytips<br />Design time support<br />
  49. 49. WPF Tooling Improvements<br />Blend3<br />Visual Studio <br />Designer<br />RAD databinding<br />Easier autolayout<br />Markup extension intellisense<br />More property editors <br />Improvements to XAML authoring and workflow<br />VSM<br />Behaviors<br />Transition animations<br />Prototyping tools<br />
  50. 50. Fundamentals<br />Framework deployment<br />Application deployment<br />Improved interop<br />Text clarity<br />Layout rounding/snapping<br />Media improvements<br />UIA – for accessibility and TFS<br />Graphics performance<br />Localization<br />
  51. 51. Graphics<br />Composition API - give application authors fine grained control over caching rendered elements in video memory<br />An input to a shader effect<br />An image brush to fill any arbitrary 2D shape<br />A texture on a 3D model <br />
  52. 52. Layout Rounding<br />UseLayoutRounding="True"<br />Rounds an object’s coordinates on whole pixels<br />
  53. 53. Client Profile Configurator Tool<br />Configurator tool http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962<br />Client profile Configuration designer “How To” series<br />http://windowsclient.net/wpf/wpf35/wpf-35sp1-start-here.aspx<br />
  54. 54. Controls <br />WPF4<br />DataGrid<br />DatePicker<br />VSM<br />Future<br />Chart Controls<br />More…<br />
  55. 55. WPF4 and VS10<br />Best way to take advantage of Windows 7<br />Solid fundamentals: Deployment and ubiquity, text clarity, interop, performance, controls, and completeness<br />Much improved tooling and designers with VS10 and Blend3<br />Do <br />Download the beta, demos and give us feedback<br />
  56. 56. Windows Presentation Foundation<br />Live Club OU<br />Controls in WPF<br />PhạmPhương Nguyên<br />Microsoft Student Partner<br />Pham.Nguyen@hotmail.com<br />phamnguyenit.wordpress.com<br />
  57. 57. Kiếntrúccủa WPF<br />User Interface Services<br />Document Services<br />XPS Documents<br />Application Services<br />Controls<br />Data Binding<br />Packaging Services<br />Deployment Services<br />Layout<br />Base Services<br />Core Presentation<br />XPS Viewer<br />Windows Presentation Foundation<br />XAML<br />2D<br />Audio<br />Imaging<br />Text<br />Accessibility<br />3D<br />Video<br />Effects<br />Input & Eventing<br />Animation<br />Property System<br />Visual Primitives<br />
  58. 58. Agenda<br />Layout Controls<br />Some Controls in WPF<br />Style và Template<br />Animation<br />DataBinding<br />Event<br />Other Demo<br />
  59. 59. www.themegallery.com<br />Layout controls<br />Can use<br />Grid<br />DockPanel<br />WPF Layout<br />StackPanel<br />Canvas<br />WrapPanel<br />
  60. 60. Layout Roundind<br /><Grid Height="100" Width="200"><br />    <Grid.RowDefinitions><br />        <RowDefinition Height="*"/><br />        <RowDefinition Height="*"/><br />        <RowDefinition Height="*"/><br />    </Grid.RowDefinitions><br />    <Rectangle Grid.Row="0" Fill="DarkBlue"/><br />    <Rectangle Grid.Row="1" Fill="DarkBlue"/><br />    <Rectangle Grid.Row="2" Fill="DarkBlue"/><br /></Grid><br />
  61. 61. demo <br />Layout<br />
  62. 62. Controls <br />TextBox<br />Button<br />ListBox<br />Radio Button<br />Label<br /><TextBox /><br /><Button/><br /><ListBox /><br /><RadioButton /><br /><Label/><br />
  63. 63. Ribbon Control<br />Office Button<br />Tab<br />Contextual Tab Set<br />Quick Access Toolbar<br />Help<br />Contextual Tab<br />Dialog Box Launcher<br />Group (aka “Chunk”)<br />Ribbon SDK<br />
  64. 64. Windows Ribbon Controls<br />Tabs and groups<br />Check boxes<br />Help button<br />Font control<br />Buttons & split buttons<br />Categorized menus<br />Dropdown galleries<br />Tooltips<br />Spinners<br />Group dialog launchers<br />“In-Ribbon” galleries<br />Mini toolbar andcontextual menu<br />Combo boxes<br />Color pickers<br />
  65. 65. demo <br />RibbonDemo<br />
  66. 66. Style và Template<br />Style<br />Tậpgiátrịcácthuộctínhhiểnthịcủanhiều controls khácnhau<br />Làmộtdạngtàinguyên (resources)<br />Cácthuộctínhquantrọngcủa Style baogồm<br />BaseOn<br />TargetType<br />Setters<br />Triggers<br />
  67. 67. Style và Template<br /> <Style TargetType="{x:Type Button}"><br /> <Style.Triggers><br /> <Trigger Property="IsPressed" Value="true"><br /> <Setter Property="Foreground" Value="Blue"/><br /> </Trigger><br /> </Style.Triggers><br /> <Setter Property="Background" Value="White"/><br /></Style><br />
  68. 68. demo <br />Style Demo<br />
  69. 69. Style và Template<br />Template<br />Button cómàusắcthayđổi -> Style<br />Button cóhìnhdạngthayđổi(hìnhtròn, ellipse) ???<br />Template<br />Cho phépthayđổicáchhiệnthịvốncócủa control<br />Thayđổicấutrúc hay cácthànhphầncấutạocủa control.<br />
  70. 70. Style và Template<br />Template<br />ControlTemplate<br />Địnhnghĩa, thayđổithểhiệncủa control<br />DataTemplate<br />Địnhnghĩacáchthứchiểnthịcủacácđốitượngdữliệu<br />
  71. 71. demo <br />Template Demo <br />
  72. 72. Events vàRoutedEvents<br />Visual Tree: cấutrúcphânlớpdạnghìnhcâycủacácphầntửtrêngiaodiện<br /><Grid><br /><WrapPanelBackground=“Pink”><br /> <ButtonName=“Button1”>Button1</Button><br /> <ButtonName=“Button2”>Button2</Button><br /></WrapPanel> <br /> <TextBlockText=“Pink”/><br /></Grid><br />
  73. 73. Events vàRoutedEvents<br />WPF mởrộngmôhìnhsựkiệnchuẩncủa .NET bằngviệcđưaraRoutedEvent<br />Bubble<br /><Event><br />Tunnel<br />Preview<Event><br />
  74. 74. Data Binding<br />Dependency Property<br />DP làcácthuộctínhcóthểmanggiátrịphụthuộcvàothuộctínhcủađốitượngkhác.<br />Đặcđiểm:<br />Khicósựthayđổigiátrịthìsẽcócácsựkiệntươngứngđượckíchhoạt<br />Kếthừagiátrịthuộctính<br />
  75. 75. UI<br />Data Binding<br />Register Events<br />Add to ListBox<br />Set Data<br />Load<br />Get<br />Data<br />Create ListBoxItem<br />Data Binding<br />Logic<br />Data Changed<br />Set<br />Move<br />Update Collection<br />Data Arrived<br />Get Data<br />Data<br />Register Events<br /><Aquarium><br /> <Thermometer/><br /> <Fish/><br /> <Fish/><br /></ Aquarium ><br />Database<br />Services<br />XML<br />
  76. 76. Data Binding<br />View<br />Data<br />Binding Target<br />Binding Source<br />Dependency Property<br />Property<br />Data Binding<br />One Way<br />Initialize Target<br />Two Way<br />Update Target<br />Update Source<br />One Time<br />Validate Errors<br />One Way To Source<br />Convert Data<br />
  77. 77. demo <br />Data Binding Demo<br />
  78. 78. Animation<br />Animation on computer<br />
  79. 79. Animation<br />Animation in WPF<br />Handles all, manage timing system, calculate state, redraw<br />Can work with both C# / VB.NET or XAML<br />Which can animate in WPF?<br />Animate objects by apply animation to theirs properties.<br />Properties must be DP<br />Animated object must be inherited from DependencyObject and implemented IAnimatable<br />Objs have compatible with animation type.<br />
  80. 80. Animation<br />Animation in WPF<br />[TypeName]Animation (17)<br />From/To/By Animation<br />[TypeName]AnimationUsingKeyFrame(22)<br />KeyFrames<br />[TypeName]AnimationUsingPath (3)<br />
  81. 81. demo <br />Animation Demo<br />
  82. 82. ?<br />?<br />?<br />Your Questions<br />?<br />?<br />?<br />
  83. 83. Thank You !<br />© 2010 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.<br />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.<br />

×