1 / 23

Using the MVVM Design Pattern with the Microsoft Visual Studio 2010 XAML Designer

Required Slide. SESSION CODE: DEV322. Using the MVVM Design Pattern with the Microsoft Visual Studio 2010 XAML Designer. Rockford Lhotka Principal Technology Evangelist Magenic. Nobody’s more serious about Microsoft. . MVVM. View. Properties. Commands. ViewModel. Properties. Methods.

marc
Download Presentation

Using the MVVM Design Pattern with the Microsoft Visual Studio 2010 XAML Designer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Required Slide SESSION CODE: DEV322 Using the MVVM Design Pattern with the Microsoft Visual Studio 2010 XAML Designer Rockford Lhotka Principal Technology Evangelist Magenic Nobody’s more serious about Microsoft.

  2. MVVM View Properties Commands ViewModel Properties Methods Model (POCO/DTO/Entity)

  3. MVVM (rich model) View Properties Commands ViewModel Methods/ Properties Model (Rich domain objects)

  4. Why MVVM?

  5. N-Layer Architecture Interface Interface Control Object Model Data Access Data Storage and Management

  6. Layered Flexibility WPF Silverlight XML Workflow Web IC IC IC IC IC Object Model Data Access Data Access Data Access Data Access Data Access DB2 WCF SQL Oracle XML

  7. Implementing the Layers Interface Patterns Interface Control Object Model Patterns Data Access Patterns Data Storage and Management

  8. The View

  9. The ViewModel

  10. The Model

  11. Connecting the Parts Drag and Drop View ViewModel Model

  12. Resource Generated in View <UserControl.Resources> <CollectionViewSource x:Key="employeeViewModelViewSource" d:DesignSource= "{d:DesignInstance my:EmployeeViewModel, CreateList=True}" /> </UserControl.Resources>

  13. Code-behind???? private void UserControl_Loaded(object sender, RoutedEventArgs e) { // Do not load your data at design time. // if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) // { // //Load your data here and assign the result to the CollectionViewSource. // System.Windows.Data.CollectionViewSourcemyCollectionViewSource= // (System.Windows.Data.CollectionViewSource)this.Resources["Resource Key"]; // myCollectionViewSource.Source= your data // } }

  14. Making MVVM Work Shell Data binding & Command router View View Status Errors View factory ViewModel ViewModel ViewModel ViewModel ViewModel (or Presenter)

  15. Building an App with MVVM DEMO

  16. Summary • MVVM is a good pattern • Avoid code-behind • MVVM requires a little “plumbing” • UI shell abstraction • Route View events to ViewModel verbs • View factory concept

  17. Thank you! Rockford Lhotka rocky@lhotka.net www.lhotka.net Nobody’s more serious about Microsoft.

  18. Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Track Resources • Visual Studio – http://www.microsoft.com/visualstudio/en-us/ • Soma’s Blog – http://blogs.msdn.com/b/somasegar/ • MSDN Data Developer Center – http://msdn.com/data • ADO.NET Team Blog – http://blogs.msdn.com/adonet • WCF Data Services Team Blog – http://blogs.msdn.com/astoriateam • EF Design Blog – http://blogs.msdn.com/efdesign

  19. Required Slide Resources Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet • http://microsoft.com/msdn

  20. Required Slide Complete an evaluation on CommNet and enter to win!

  21. Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registrationJoin us in Atlanta next year

  22. © 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. 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.

  23. Required Slide

More Related