Presentation is loading. Please wait.

Presentation is loading. Please wait.

Build Windows 10 UWP MVVM Apps with Prism

Similar presentations


Presentation on theme: "Build Windows 10 UWP MVVM Apps with Prism"— Presentation transcript:

1 Build Windows 10 UWP MVVM Apps with Prism
Brian Noyes @briannoyes, Slides and Demos:

2 Visual Studio Connections
About Brian Noyes CTO and Co-founder, Solliance Microsoft Regional Director Microsoft MVP Pluralsight author Web API Insider, Windows Azure Insider, Window Store App Insider, C#/VB Insider t e @briannoyes Updates will be available at

3 UI Separation Patterns Goals
Architectural goals Loose coupling Separation of concerns Leads to Maintainability Testability Extensibility Putting all your logic here is not good enough

4 Prism Overview Framework for building XAML apps OSS
Maintainable Testable Extensible OSS Current XAML Targets WPF Windows 10 UWP Xamarin Forms

5 Prism Versions 2008 2009 2010 2011 2012 2013 2014 2015 2016 Prism 1.0 Prism 2.0 Prism 4.0 Prism 5 Prism 6 for WPF (OSS) Prism 2.1 Prism 4.1 Prism 2.2 MVVM PubSub Events PubSub Events Prism 6 for UWP (OSS) Prism for Windows Runtime Prism for Universal Apps

6 Prism 6 for UWP Relation to Previous Releases
Direct port of the Prism for Windows Runtime (Win8/8.1) versions of Prism Some reorganization and renaming Enhancements to leverage some new UWP features and design guidance

7 Prism for UWP Key Features
MVVM + Extensible Application Structuring Well defined abstractions for different kinds of presentation layer code Views, ViewModels, Models, Bootstrapping, Dependency Injection Communications Loosely coupled communications with events and commands Navigation Layers on top of native UWP navigation and integrates it into the MVVM pattern State Management Lets you identify cached transient objects that you want to have automatically restored when app restarts from suspension and termination Validation Includes a reusable infrastructure for data input validation that ties into data binding and MVVM well

8 MVVM Structuring View Data Binding ViewModel Model Model Object Model
Client Services

9 MVVM Principals Model View ViewModel
Data structures and logic to provide data for presentation View Just the structure of what the user sees on the screen Static and dynamic ViewModel Provides data to the view for binding / presentation Wrapped or exposed model objects Client application state Interaction logic

10 Prism MVVM Support Commands INotifyPropertyChanged support
PubSubEvents InvokeCommandAction InteractionRequest ViewModelLocator

11 ViewModelLocator Consolidates MVVM hookup responsibilities
Select a ViewModeltype to go with a View type that is being loaded Create an instance of that ViewModeltype View.DataContext= ViewModel Convention-based by default Views live in .Views child namespace ViewModelslive in .ViewModels child namespace ViewModelname = View name + “ViewModel” Uses ViewModeldefault constructor Can override View type to ViewModeltype mapping Provide default factory for all ViewModeltypes Provide factory method for individualViewModeltypes

12 MVVM and UWP Navigation
Page Page ViewModel ViewModel INavigationService FrameNavigationService Frame

13 Application Lifecycle Management
UWP application lifecycle states: Not Running Running Suspended ClosedByUser Terminated Not Running Launch Running Launch Launch Switch Back Switch Apps Terminated Suspended ClosedByUser Low Memory Shutdown

14 Validation UI

15 Prism Validation Support
BindableValidator Manages a collection of errors per property for a data object Raises events when the errors change to support data binding Can evaluate DataAnnotations automatically ValidatableBindableBase Derives from BindableBase Contains a BindableValidator Exposes errors for data binding Triggers validation when properties change HighlightXYZOnErrors behaviors Attached behaviors to show a red box on control when there are errors associated with the bound property

16 Resources e t Github.com/prismlibrary Pluralsight
@briannoyes Resources Github.com/prismlibrary Pluralsight Building Windows Store Business Apps Slides and Demos:

17 Please use Event Board to fill out a session evaluation.
Questions? Please use Event Board to fill out a session evaluation. Thank you!


Download ppt "Build Windows 10 UWP MVVM Apps with Prism"

Similar presentations


Ads by Google