SlideShare a Scribd company logo
INTRODUCTION TO WPF
AND MVVM
SIRAR SALIH
.NET CONSULTANT
Introduction to WPF and MVVM
Windows Presentation Foundation
• Graphical subsystem introduced by Microsoft to render user interfaces, and
allow development of rich, interactive client applications
• Was initially known as «Avalon» and first released in .NET 3.0
• Uses DirectX
• 2D/3D rendering, vector graphics, animation etc.
• Attempts to seperate UI from logic
– XAML
• Deployment
– Standalone desktop client
– Can also be embedded in web

19.01.2014

/

3
Windows Presentation Foundation
• Microsoft PixelSense (Surface 2.0)

19.01.2014

/

4
Windows Presentation Foundation
• Silverlight
– Most functionality is a subset of WPF
• Latest release: WPF 4.5

19.01.2014

/

5
Model-View-ViewModel
• Architectural pattern based on Model-View-Controller (MVC)
• Seperation of Concerns
– Data/Domain objects (Model), GUI (View), logic (ViewModel)

• Eliminates «code-behind»
• The beauty of it: Designers can work indepedently on the views and UX,
while developers work on the back-end

• Allows [easier]:
– Maintainability
– Testability
– Blendability

19.01.2014

/

6
Model-View-ViewModel
GUI

View

Logic

ViewModel

Domain

Model

19.01.2014

/

7
WPF + MVVM

How about we combine them? That’s awesome! 

19.01.2014

/

8
Combining WPF and MVVM
View
Commands

DataBinding

ViewModel

Model

19.01.2014

/

9
DataBinding
• Establishes connection between Views and ViewModels
• Enables the View to bind to properties in the ViewModel
• DataContext
• Two-way binding
• Dependency properties

19.01.2014 /

10
Commands
• Enable the View to call methods in the ViewModel
• Exposed as properties from the ViewModel
• Implement ICommand

19.01.2014 /

11
MVVM frameworks for WPF
Cocktail
Carbon MVVM

Caliburn
Xomega

MVVM Cross

MVVM foundation

Onyx

MVVM Light Toolkit
Cinch

Jounce

Core MVVM
Ocean

Prism
Reactive UI

Goldlight

Catel

19.01.2014 /

12
MVVM Light Toolkit
•
•
•
•
•
•
•

By Laurent Bugnion
Small and simple
Breaking the monotony
Essentials library
Extras library
Project templates
Code snippets

19.01.2014 /

13
ViewModelBase
• Utility class that ViewModel inherits from
• Eliminates code duplication
• Introduces the RaisePropertyChanged method, among others

19.01.2014 /

14
EventToCommand
• Enables the passing of arguments to the ViewModel through the Command
• Interaction triggers are used on top, for events (that fire the command)

19.01.2014 /

15
RelayCommand
• An alternative to Command and RoutedCommand in WPF
• Also implements ICommand
• Relays Execute to own defined method, therefore eliminates the need to
create a class for each custom Command

19.01.2014 /

16
Messaging
• Easier communication between ViewModels
• Uses Publish-Subscribe pattern
• A receiver ViewModel registeres on a specific type message
• A sender ViewModel creates a message of that specific type and sends
it, receiver gets it

19.01.2014 /

17
Messaging
View

View
Messages

ViewModel

ViewModel
View
Messages

ViewModel
19.01.2014 /

18
Messaging
• Message:

• Sender:

• Receiver:

19.01.2014 /

19
DispatcherHelper
• Useful when working on multi-threaded WPF applications
• Enables the calling of a method on the UI thread from a different thread
• Use this or DispatcherTimer when creating a thread, never use a Timer

19.01.2014 /

20
Live demo

19.01.2014 /

21
Future of WPF
• Windows RT
– No support
• Windows 8 Desktop
– Works
• XAML usage in Windows 8 Store apps

19.01.2014 /

22
QUESTIONS?
THANK YOU

19.01.2014 /

23
Introduction to WPF and MVVM

More Related Content

PPTX
Training: MVVM Pattern
PPTX
MVVM Design Pattern NDC2009
PPTX
MVVM - Model View ViewModel
PPTX
Mvvm basics
PPTX
MVVM with WPF
 
PPTX
MVVM Lights
PPTX
Design Pattern - MVC, MVP and MVVM
Training: MVVM Pattern
MVVM Design Pattern NDC2009
MVVM - Model View ViewModel
Mvvm basics
MVVM with WPF
 
MVVM Lights
Design Pattern - MVC, MVP and MVVM

What's hot (20)

PPTX
MVx patterns in iOS (MVC, MVP, MVVM)
PPTX
MVVM ( Model View ViewModel )
PDF
Mvc, mvp, mvvm...
PDF
Ui design patterns
PPTX
Slide Presentation of MVP Pattern Concept
PPTX
Model View Presenter (MVP) In Aspnet
PPTX
Acrhitecture deisign pattern_MVC_MVP_MVVM
PPTX
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
PPTX
Mvc fundamental
PPTX
Javascript from beginning to modern
PDF
MVVM in iOS presentation
PPTX
MVVM and Prism
PDF
Introduction to Microsoft Prism
PPTX
Introduction To Model View Presenter
PPTX
Building xamarin.forms apps with prism and mvvm
PDF
MVC Seminar Presantation
PPT
MVC Pattern. Flex implementation of MVC
PPTX
WPF with MVVM: From the Trenches
PPTX
Adopting MVVM
MVx patterns in iOS (MVC, MVP, MVVM)
MVVM ( Model View ViewModel )
Mvc, mvp, mvvm...
Ui design patterns
Slide Presentation of MVP Pattern Concept
Model View Presenter (MVP) In Aspnet
Acrhitecture deisign pattern_MVC_MVP_MVVM
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Mvc fundamental
Javascript from beginning to modern
MVVM in iOS presentation
MVVM and Prism
Introduction to Microsoft Prism
Introduction To Model View Presenter
Building xamarin.forms apps with prism and mvvm
MVC Seminar Presantation
MVC Pattern. Flex implementation of MVC
WPF with MVVM: From the Trenches
Adopting MVVM
Ad

Similar to Introduction to WPF and MVVM (20)

PDF
MVVM Light Toolkit Works Great, Less Complicated
PPTX
Presentation Model
PDF
PPTX
Understanding The MVVM Pattern (TechDays Belgium)
PPTX
Introduction To Useful Wpf
PPTX
MVVM+MEF in Silvelight - W 2010ebday
PPTX
Building an enterprise app in silverlight 4 and NHibernate
PPTX
Advanced MVVM in Windows 8
PPTX
Introduction to MVVM Framework
PPT
Model View ViewModel
PPTX
Mvvm in the real world tccc10
PPTX
Meetup - Getting Started with MVVM Light for WPF - 11 may 2019
PDF
Infragistics: Getting Started with MVVM in WPF & Silverlight
PDF
Introduction To MVVM
PPSX
Software Design Patterns
PDF
Complete WPF Overview Tutorial with Example - iFour Technolab
PDF
Portable Class Libraries and MVVM
PPT
PPT
Introduction to XAML and WPF
PPTX
Applied MVVM in Windows 8 apps: not your typical MVVM session!
MVVM Light Toolkit Works Great, Less Complicated
Presentation Model
Understanding The MVVM Pattern (TechDays Belgium)
Introduction To Useful Wpf
MVVM+MEF in Silvelight - W 2010ebday
Building an enterprise app in silverlight 4 and NHibernate
Advanced MVVM in Windows 8
Introduction to MVVM Framework
Model View ViewModel
Mvvm in the real world tccc10
Meetup - Getting Started with MVVM Light for WPF - 11 may 2019
Infragistics: Getting Started with MVVM in WPF & Silverlight
Introduction To MVVM
Software Design Patterns
Complete WPF Overview Tutorial with Example - iFour Technolab
Portable Class Libraries and MVVM
Introduction to XAML and WPF
Applied MVVM in Windows 8 apps: not your typical MVVM session!
Ad

More from Sirar Salih (10)

PPTX
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
PPTX
Azure Table Storage: The Good, the Bad, the Ugly (full talk)
PPTX
Azure Table Storage: The Good, the Bad, the Ugly (10 min. lightning talk)
PPTX
Angular 2 + TypeScript = true. Let's Play!
PPTX
Test Driving AngularJS
PPTX
Test Driven Development with AngularJS
PPTX
One Framework to Rule Them All
PPTX
When Two Forces Meet
PPTX
Clean Code
PPTX
Angularfying Your ASP.NET MVC APP
Azure Table Storage: The Good, the Bad, the Ugly (15 min. lightning talk)
Azure Table Storage: The Good, the Bad, the Ugly (full talk)
Azure Table Storage: The Good, the Bad, the Ugly (10 min. lightning talk)
Angular 2 + TypeScript = true. Let's Play!
Test Driving AngularJS
Test Driven Development with AngularJS
One Framework to Rule Them All
When Two Forces Meet
Clean Code
Angularfying Your ASP.NET MVC APP

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Approach and Philosophy of On baking technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
A Presentation on Artificial Intelligence
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Tartificialntelligence_presentation.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
1. Introduction to Computer Programming.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Approach and Philosophy of On baking technology
Per capita expenditure prediction using model stacking based on satellite ima...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
Accuracy of neural networks in brain wave diagnosis of schizophrenia
A Presentation on Artificial Intelligence
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Tartificialntelligence_presentation.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Digital-Transformation-Roadmap-for-Companies.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Assigned Numbers - 2025 - Bluetooth® Document
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
1. Introduction to Computer Programming.pptx

Introduction to WPF and MVVM