15
Caliburn.Micro Opinionated MVVM Framework

Caliburn micro

Embed Size (px)

Citation preview

Page 1: Caliburn micro

Caliburn.MicroOpinionated MVVM Framework

Page 2: Caliburn micro

Brief History of Caliburn.Micro

Created by Rob EisenbergBased on mature Caliburn projectOpens sourceAround 2,700 lines of codeSingle dependency - System.Windows.InteractivityEnterprise team is having fun learning it right now

Page 3: Caliburn micro

Caliburn.Micro Elevator Pitch

A better version of what nearly every WPF veteran has attempted to home-growReduces the drudgery of property binding and commands Simplifies building a deeply composed UIHelps unify the programming models of WPF, Silverlight and Windows Phone 7Asynchronous programming supportSmall footprint & highly customizable

Page 4: Caliburn micro

Core Concepts

MVVM (Model-View-ViewModel)

Convention over Configuration

Actions

Event Aggregator (pub-sub)

Bootstrapper

Conductors and Screens

Coroutines

Page 5: Caliburn micro

Demo

WE WANT THE DEMO!

WE WANT THE DEMO!

WE WANT THE … CUP!

Page 6: Caliburn micro

Lifecycle

• Application start up• Bootstrapper code is executed• ViewLocator.LocateForModel()• ViewModelBinder.Bind()• The rest of stuff happens

Page 7: Caliburn micro

Conventions = Magic

Page 8: Caliburn micro

Convention Over Configuration

Convention = Do More With Less Code

View Location & CompositionProperty Binding

Content controlsItems controls

Action BindingConfigurable Conventions (Convention Manager)

Page 9: Caliburn micro

Troubleshooting Magic

Common Issues With Conventions:MisspellingsData Templates

Troubleshooting Techniques:LoggingRefactoring with R#

Page 10: Caliburn micro

Data Binding

PropertyChangedBaseNo strings when notifying about property change!Lambda-based notificationsNotifyOfPropertyChange(() => PropertyName);

BindableCollection

ObservableCollection extensionRaises events on the UI thread

Page 11: Caliburn micro

Actions

Allows to bind UI triggers to ViewModel methodsAllows for passing parametersParameters are type converted to method’s signatureCanExecute guard is supportedFull design-time support in BlendSupport Coroutines

Page 12: Caliburn micro

Event Aggregator

Pub/SubCommunication between ViewModelsHighly decoupled

Page 13: Caliburn micro

Screens & Conductors

State machine for UI compositionScreen has a lifecycle associated with it

ActivationDeactivation

Screen ConductorOrchestrates screensEnforces screen lifecycleGraceful shutdown

Page 14: Caliburn micro

Coroutines

Asynchronous programming supportUtilizes iterators to yield results

Page 15: Caliburn micro

FIN