infragistics: getting started with mvvm in wpf & silverlight

15

Click here to load reader

Upload: nish-anil

Post on 26-Jun-2015

1.037 views

Category:

Documents


0 download

DESCRIPTION

OCT 31 Webinar Slides

TRANSCRIPT

Page 1: Infragistics: Getting Started with MVVM in WPF & Silverlight
Page 2: Infragistics: Getting Started with MVVM in WPF & Silverlight

NISHANTH ANIL

TECHNICAL EVANGELIST

| [email protected] | nnish.com

facebook.com/InfragisticsIndia

Getting Started with MVVM in (WPF / Silverlight)

@nishanil

Page 3: Infragistics: Getting Started with MVVM in WPF & Silverlight

– Patterns

– What’s MVVM?

– Foundation (WPF concepts)

– Available Frameworks

– Your First ViewModel (demo)

– Simple Dashboard (demo)

Agenda

@nishanil

Page 4: Infragistics: Getting Started with MVVM in WPF & Silverlight

• UI patterns – Model – View – Controller

– Model – View – Presenter

– Presentation Model

– Model – View – ViewModel

• Why do they exist? – Separation of concerns

– Testability

– Maintainability

Patterns – are guidelines not rules!

@nishanil

Page 5: Infragistics: Getting Started with MVVM in WPF & Silverlight

MVVM

@nishanil

Page 6: Infragistics: Getting Started with MVVM in WPF & Silverlight

• INotifyPropertyChanged/INotifyCollectionChanged

• DataContext

• DataBinding

• Commanding

Foundation – WPF Concepts

@nishanil

Page 7: Infragistics: Getting Started with MVVM in WPF & Silverlight

• INotifyPropertyChanged – Not a WPF only concept (part of an implementation of GOF Observer pattern)

• Observer Pattern in brief: When one object changes state, all its dependents are notified and updated automatically.

– Implement INotifyPropertyChanged in your ViewModels

– And Notify when property changes

• INotifyCollectionChanged – Similar to INotifyProperyChanged, but it applies to collections of objects

– Use ObservableCollection<T> instead of manually implementing

Foundation – WPF Concepts

@nishanil

Page 8: Infragistics: Getting Started with MVVM in WPF & Silverlight

• DataBinding – A View binds to properties on a ViewModel

• DataContext – Set ViewModel to the DataContext of the View

– This property is meant to be set to the data object it visualizes.

Foundation – WPF Concepts

@nishanil

Page 9: Infragistics: Getting Started with MVVM in WPF & Silverlight

• Commanding – Is an input mechanism

– Without command MVVM will be less powerful

– Commands in WPF are implemented using ICommand interface

Binding the command in the View

Foundation – WPF Concepts

@nishanil

ViewModel

ICommand Implementation

Page 10: Infragistics: Getting Started with MVVM in WPF & Silverlight

Available Frameworks

@nishanil Source: Wikipedia, As on 31st OCT 2012

Page 11: Infragistics: Getting Started with MVVM in WPF & Silverlight

• MVVM Foundation

– http://mvvmfoundation.codeplex.com/

– ObservableObject Class

– RelayCommand

Some helper files

@nishanil

Page 12: Infragistics: Getting Started with MVVM in WPF & Silverlight

• Writing your first ViewModel

• A simple Sales dashboard

Demo

@nishanil

Page 13: Infragistics: Getting Started with MVVM in WPF & Silverlight

Silverlight: MVVM + RIA

@nishanil

Page 14: Infragistics: Getting Started with MVVM in WPF & Silverlight

• Introduction to Model/View/ViewModel pattern for building WPF apps (John Gossman) – http://blogs.msdn.com/b/johngossman/archive/2005/10/08/478683.a

spx

• WPF Apps With The Model-View-ViewModel Design Pattern (Josh Smith) – http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

• Infragistics Community – http://www.infragistics.com/community/blogs/

• Infragistics WPF Products - http://www.infragistics.com/products/wpf/

• Infragistics Silverlight Products - http://www.infragistics.com/products/silverlight/

Resources

@nishanil

Page 15: Infragistics: Getting Started with MVVM in WPF & Silverlight

Q&A

NISHANTH ANIL

TECHNICAL EVANGELIST

| [email protected] | nnish.com

facebook.com/InfragisticsIndia

@nishanil