Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Building Data Centric Apps in WPF


Published on

Presentation from teh MDC DC

Published in: Technology
  • Be the first to comment

Building Data Centric Apps in WPF

  1. 1. <ul><li>Frank La Vigne Lead Designer/Architect, Applied Information Sciences </li></ul><ul><li> </li></ul>
  2. 2. <ul><li>Frank La Vigne </li></ul><ul><ul><li>Microsoft MVP: Tablet PC </li></ul></ul><ul><ul><li>INETA Membership Mentor for DC, Maryland and Delaware </li></ul></ul><ul><ul><li>Manager/Founder Silverlight SIG </li></ul></ul><ul><ul><li>Lead Designer @ AIS </li></ul></ul><ul><ul><ul><li>Blog: </li></ul></ul></ul><ul><ul><ul><li>Company: </li></ul></ul></ul><ul><ul><ul><li>Twitter: @Tableteer </li></ul></ul></ul><ul><ul><li>Feedback to </li></ul></ul><ul><ul><ul><li>[email_address] </li></ul></ul></ul>
  3. 4. <ul><li>Learn how we’re enabling you to build Data-centric Line of Business applications in WPF much more easily </li></ul><ul><li>See the new Ribbon and DataGrid controls and understand how to use them right now </li></ul><ul><li>See how wiring up data to your application will be easier in Visual Studio 2010 </li></ul><ul><li>All of this mostly in demos , not slides! </li></ul><ul><li>Slides will recap so you can find stuff later… </li></ul>
  4. 5. Frank La Vigne
  5. 6. Frank La Vigne
  6. 7. <ul><li>Great features out-of-the-box </li></ul><ul><ul><li>Autogenerate columns in one line of XAML </li></ul></ul><ul><ul><li>Resizing, reordering, sorting, selection, editing, keyboard navigation </li></ul></ul><ul><ul><li>Use stock columns or define your own </li></ul></ul><ul><li>Where to get DataGrid & DatePicker </li></ul><ul><ul><li>Download V1 today in the WPF Toolkit </li></ul></ul><ul><ul><ul><li> </li></ul></ul></ul><ul><li>Later, also available in .NET 4.0 </li></ul>
  7. 8. Frank La Vigne
  8. 9. <ul><li>Getting started with Ribbon </li></ul><ul><ul><li>RibbonCommands are the heart of the Ribbon </li></ul></ul><ul><ul><li>Use RibbonWindow for title bar integration </li></ul></ul><ul><ul><li>Customize resizing without writing layout code </li></ul></ul><ul><li>Where to get Ribbon </li></ul><ul><ul><li>Download CTP today at Office UI Licensing Site </li></ul></ul><ul><ul><ul><li> </li></ul></ul></ul><ul><ul><li>Sign the Office License to access the download </li></ul></ul><ul><ul><li>Use Office UI Licensing Guidelines in to improve the quality of your application </li></ul></ul><ul><ul><li>V1 available in 2009 </li></ul></ul>
  9. 10. Frank La Vigne
  10. 11. <ul><li>Row Details </li></ul><ul><ul><li>Show additional fields within the grid </li></ul></ul><ul><li>Row-Level Validation </li></ul><ul><ul><li>Cross-field validation for end-user input </li></ul></ul><ul><li>DataGrid Customization </li></ul><ul><ul><li>Extensive styling to create a branded, unique UI </li></ul></ul>
  11. 12. <ul><li>Built-in skins for Win7 & Office 2007 </li></ul><ul><li>“ Smart UI” generates appropriate visuals </li></ul><ul><ul><li>Application Menu Items </li></ul></ul><ul><ul><li>Quick Access Toolbar </li></ul></ul><ul><ul><li>Contextual Tabs </li></ul></ul><ul><li>Full control over resizing layout </li></ul><ul><ul><li>Replace RibbonWrapPanel to override default behavior </li></ul></ul>
  12. 13. <ul><li>Initial setup: </li></ul><ul><ul><li>Familiar Windows Forms RAD Data Sources Window experience </li></ul></ul><ul><li>Editing: </li></ul><ul><ul><li>Powerful data binding picker lets you customize and create data bindings without understanding data binding syntax </li></ul></ul><ul><li>XAML: </li></ul><ul><ul><li>Will provide data binding Intellisense support , for those who prefer to work in XAML </li></ul></ul>
  13. 14. Frank La Vigne
  14. 15. <ul><li>WPF is well on its way to being a great platform for LOB developers </li></ul><ul><li>Our new controls will help make LOB developers more productive </li></ul><ul><li>You get the new controls today at </li></ul><ul><ul><li>DataGrid, DatePicker: </li></ul></ul><ul><ul><ul><li> </li></ul></ul></ul><ul><ul><li>Ribbon: </li></ul></ul><ul><ul><ul><li> </li></ul></ul></ul><ul><li>Our next generation Visual Studio tooling will include many new features to help you be more productive, especially with data binding </li></ul>
  15. 16. <ul><li>Robot Pack - Lego NXT Robot Kit + WROX Robotics Developer Studio book </li></ul><ul><li>Mobility Pack - LifeCam NX-6000 & Wireless Notebook Laser Mouse 6000 </li></ul><ul><li>Gamer Pack - Gears of War 2, PGR4, Mass Effect, Xbox 360 Wireless Headset & 3-month XBOX Live Card </li></ul><ul><li>MSDN Subscription - one-year VSTS 2008 Team Suite w/MSDN Premium Subscription </li></ul><ul><li>SoftLayer : Free WS 2008 Web Edition and SQL Web Edition with any server order over $179 </li></ul>+ Giveaways will happen at the end of the last session in each breakout room. You must fill out page 1 completely and you must be present to win.
  16. 18. © 2008 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.
  17. 19. <ul><ul><li>Goal: Enable a range of apps to use Ribbons </li></ul></ul><ul><ul><li>Future Plans </li></ul></ul><ul><ul><ul><li>Markup for MFC Ribbon </li></ul></ul></ul><ul><ul><ul><li>Designer tools </li></ul></ul></ul>Target: MFC Native Win2k or newer Office 2007 Visual Style Available now in Visual Studio 2008 SP1 Target: Native Vista or newer Windows Visual Style Coming Soon… Ships with Windows 7 Target: Managed Needs .NET 3.5 Office 2007 & Windows Styles Coming Soon.. Official Release in 2009 Microsoft’s Ribbon Strategy MFC Scenic WPF
  18. 20. *Custom sort implementation instructions can be found on Jossef Goldberg’s blog: Scroll Test <ul><li>WPF DataGrid </li></ul><ul><li>Recycling </li></ul><ul><li>Row & Column Virtualization </li></ul><ul><li>WPF ListView </li></ul><ul><li>Recycling </li></ul><ul><li>Row Virtualization </li></ul>WinForms DataGrid Page down 50 pages 5.5 sec 6.5 sec 3.8 sec Line down 500 lines 12.1 sec 11.9 sec 3.9 sec Sort Test WPF DataGrid with Custom Sort* WinForms DataGrid Sort 6,000 rows 59 msec 35 msec Sort 300,000 rows 1.8 sec 1.4 sec
  19. 22. <ul><li>Create a DataGrid </li></ul><ul><li>Out of the box, you get </li></ul><ul><ul><li>Auto-generated columns </li></ul></ul><ul><ul><li>End-user Row and Column Resizing </li></ul></ul><ul><ul><li>End-user Drag/Drop Column Reordering </li></ul></ul><ul><ul><li>Sorting </li></ul></ul><ul><ul><li>Editing </li></ul></ul><ul><ul><li>Variety of Selection Units/Modes </li></ul></ul><dg:DataGrid ItemsSource=&quot;…&quot;>
  20. 23. <ul><li>Edit the Columns Collection </li></ul><ul><ul><li>On design surface, right-click DataGrid and choose DataGrid  Add/Edit Columns </li></ul></ul><ul><li>In XAML </li></ul><dg:DataGrid AutoGenerateColumns=&quot;False&quot;> <dg:DataGrid.Columns> <dg:DataGridTextColumn Header=&quot;Title&quot; Binding=&quot;{Binding Title}“ Width=“SizeToCells”/> </dg:DataGrid.Columns> </dg:DataGrid>
  21. 24. <ul><li>Create a Custom Column </li></ul><dg:DataGridTemplateColumn Header=&quot;Appointment&quot;> <dg:DataGridTemplateColumn.CellTemplate> <DataTemplate> <dg:DatePicker SelectedDate=&quot;{Binding ApptDate}&quot;/> </DataTemplate> </dg:DataGridTemplateColumn.CellTemplate> </dg:DataGridTemplateColumn>
  22. 25. <ul><li>Define RibbonCommand </li></ul><ul><ul><li>Ribbon development is view-model centric </li></ul></ul><ul><ul><li>RibbonCommands are the heart of Ribbon’s intent-driven paradigm </li></ul></ul><ul><ul><li>Define a RibbonCommand for each control and group </li></ul></ul><r:RibbonCommand x:Key=&quot;OpenCommand&quot; CanExecute=&quot;RibbonCommand_CanExecute&quot; Executed=&quot;RibbonCommand_Executed&quot; LabelTitle=&quot;Open Profile&quot; ToolTipTitle=&quot;Open Profile&quot; SmallImageSource=&quot;OpenIcon.png&quot;/>
  23. 26. <ul><li>Add Ribbon with Tabs, Groups, & Controls </li></ul><r:Ribbon> <r:RibbonTab Label=&quot;Home&quot;> <r:RibbonGroup Name=&quot;Price&quot; Command=&quot;{…}&quot;> <r:RibbonButton Command=&quot;{…}&quot;/> <r:RibbonButton Command=&quot;{…}&quot;/> <r:RibbonButton Command=&quot;{…}&quot;/> </r:RibbonGroup> </r:RibbonTab> </Ribbon>
  24. 27. <ul><li>Change Window to RibbonWindow </li></ul><ul><ul><li>In XAML </li></ul></ul><ul><ul><li>In code behind </li></ul></ul><Window>  <r:RibbonWindow> public partial class Window1 : Window  public partial class Window1 : RibbonWindow
  25. 28. <ul><li>Determine Resizing Behavior </li></ul><ul><ul><li>Default RibbonWrapPanel collapses groups cyclically from right to left as width decreases </li></ul></ul><ul><ul><li>Set GroupSizeDefinitions on the group to specify layout templates </li></ul></ul><ul><ul><li>Set GroupSizeReductionOrder on the tab to specify the collapse order of the groups </li></ul></ul>
  26. 29. <ul><li>Row Details </li></ul><ul><ul><li>Set the RowDetailsTemplate </li></ul></ul><ul><ul><li>Choose a Visibility Mode </li></ul></ul><dg:DataGrid.RowDetailsTemplate> <DataTemplate> <TextBlock Text=&quot;{Binding Description}&quot;/> </DataTemplate> </dg:DataGrid.RowDetailsTemplate> <dg:DataGrid RowDetailsVisibilityMode=&quot;VisibleWhenSelected&quot;>
  27. 30. <ul><li>Row Level Validation </li></ul><ul><ul><li>Define the Validation rule and apply it to the DataGrid </li></ul></ul><ul><ul><li>Define the Validation Error Template </li></ul></ul><dg:DataGrid.RowValidationRules> <d:DateValidationRule/> </dg:DataGrid.RowValidationRules> <dg:DataGrid.RowValidationErrorTemplate> <ControlTemplate> … </ControlTemplate> <dg:DataGrid.RowValidationErrorTemplate>
  28. 31. <ul><li>DataGrid Styling Properties </li></ul><ul><ul><li>Background & AlternatingRowBackground </li></ul></ul><ul><ul><li>GridLinesVisibility </li></ul></ul><ul><ul><li>Horizontal/VerticalGridLinesBrush </li></ul></ul><ul><ul><li>HeadersVisibility </li></ul></ul><ul><ul><li>RowHeaderWidth & ColumnHeaderHeight </li></ul></ul><ul><ul><li>ColumnHeaderStyle & ColumnHeaderTemplate </li></ul></ul><ul><ul><li>RowHeaderStyle & RowHeaderTemplate </li></ul></ul><ul><ul><li>CellStyle, RowStyle </li></ul></ul>
  29. 32. <ul><li>Apply Office 2007 Skin to Ribbon </li></ul><Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source=&quot;/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml&quot; /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources>
  30. 33. <ul><li>Application Menu </li></ul><ul><ul><li>RibbonApplication[Split]MenuItems appear as [Split]MenuItems only if they have children, otherwise they are buttons </li></ul></ul><r:Ribbon.ApplicationMenu> <r:RibbonApplicationMenu Command=&quot;…&quot;> <r:RibbonApplicationMenuItem Command=&quot;…&quot;> <r:RibbonApplicationMenuItem Command=&quot;…/> <r:RibbonApplicationMenuItem Command=&quot;…/> </r:RibbonApplicationMenuItem>
  31. 34. <ul><li>Quick Access Toolbar </li></ul><ul><ul><li>Use the Placement attached property to add controls to the QAT’s Customize Menu </li></ul></ul><r:Ribbon.QuickAccessToolBar> <r:RibbonQuickAccessToolBar> <r:RibbonButton Command=&quot;…&quot; r:RibbonQuickAccessToolBar.Placement=&quot;InCustomizeMenu&quot;/> <r:RibbonToggleButton Command=&quot;…&quot; r:RibbonQuickAccessToolBar.Placement=&quot;InToolBar&quot;/>
  32. 35. <ul><li>Advanced Ribbon Resizing </li></ul><ul><ul><li>If complex resizing templates are needed (e.g., Word 2007 Font group), replace the RibbonWrapPanel with a custom panel </li></ul></ul><RibbonGroup Name=&quot;Font&quot;> <RibbonGroup.ItemsPanel> <ItemsPanelTemplate> <MyRibbonFontWrapPanel/> </ItemsPanelTemplate> </RibbonGroup.ItemsPanel>
  33. 36. <ul><li>Contextual Tabs </li></ul><r:Ribbon.ContextualTabGroups> <r:RibbonContextualTabGroup Label=“Draw&quot;> <r:RibbonTab Label=“Format Picture&quot;> … </r:RibbonTab> <r:RibbonTab Label=“Insert Drawing&quot;> … </r:RibbonTab> </r:RibbonContextualTabGroup> </r:Ribbon.ContextualTabGroups>