Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

MVVM with Caliburn.Micro

9,304 views

Published on

With all the MVVM frameworks out there, it’s hard to know which one is best for you. In this session, we will look at one of the best MVVM frameworks out there: Caliburn.Micro. We will build an application from the ground up to show how to get started with Caliburn.Micro from the perspective that matters the most: the code.

Published in: Technology
  • I'd advise you to use this service: ⇒ www.WritePaper.info ⇐ The price of your order will depend on the deadline and type of paper (e.g. bachelor, undergraduate etc). The more time you have before the deadline - the less price of the order you will have. Thus, this service offers high-quality essays at the optimal price.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Sie können Hilfe bekommen bei ⇒ www.WritersHilfe.com ⇐. Erfolg und Grüße!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I can definitely recommend a website that really helped me with my essay. I found out it was due the day before I had to submit it. Went into full-on panic mode. Worst experience of my senior year by far. It’s called ⇒ HelpWriting.net ⇐. The quality of the writing is passable but the completion rate is super quick. You get to pick your own writer to do your stuff and that’s also a big bonus.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ❤❤❤ http://bit.ly/2F4cEJi ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Sex in your area is here: ❤❤❤ http://bit.ly/2F4cEJi ❤❤❤
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

MVVM with Caliburn.Micro

  1. 1. MVVM with Caliburn.MicroBrent Edwards
  2. 2. Brent EdwardsLead Consultant with MagenicBrentE@magenic.com@brentledwardsbrentedwards.nethttps://github.com/brentedwards
  3. 3. Level Set – Audience Background• XAML (WPF, Silverlight, Windows Phone 7, WinRT)• MVVM• Caliburn.Micro
  4. 4. Sample Application - Phonebook[Demo]
  5. 5. What Is MVVM?• Model-View-ViewModel
  6. 6. What Is Caliburn.Micro?• Small, powerful MVVM framework for XAML platforms• Technologies Supported – WPF 4.0 – Silverlight 4.0/5.0 – WP7 – WinRT/Metro• http://caliburnmicro.codeplex.com/
  7. 7. How It Works• Some Configuration• Some Convention• Some Magic
  8. 8. Configuration: Bootstrapper• Application foundation• Configure Inversion of Control container• Bootstrapper<TRootModel> – Configures first View/ViewModel to show• By default, Nuget includes a Bootstrapper for MEF
  9. 9. Bootstrapper[Demo]
  10. 10. Convention: Views/ViewModels• View Resolution is ViewModel-First• Views/ViewModels wired together by convention• Entity naming convention – {EntityName}ViewModel  {EntityName}View• Namespace naming convention (Good practice) – ProjectName.ViewModels.{ViewModel} – ProjectName.Views.{View}
  11. 11. ViewModel-First[Demo]
  12. 12. Actions• What are they? – Call methods on ViewModel from event fired in View• 2 ways to use Actions 1. By Convention 2. Explicitly with Message.Attach
  13. 13. Actions - Convention• How it works – Name a Control in XAML – Create method on ViewModel with same name – Caliburn.Micro automagically wires them together • Remember the magic I mentioned?• Positives • Negatives – Very easy to develop – No runtime errors if names – Keeps XAML clean don’t match – No design-time support
  14. 14. Action Convention[Demo]
  15. 15. Actions - Explicit• How it works – Add attached property Message.Attach – Specify the event, method to call, and even parameters• Positives • Negatives – No magic – None that I’ve found • Other devs can easily see what you are calling – Simple parsing gives great flexibility
  16. 16. Message.Attach[Demo]
  17. 17. More Message.Attach<Button Content="Remove" cal:Message.Attach="[Event Click] = [Action Remove($dataContext)]" /><Button Content="Click Me" cal:Message.Attach="[Event Click] = [Action SayHello(Name.Text)]" /><Button Content="Click Me" cal:Message.Attach="SayHello(Name)" /><Button Content="Lets Talk“ cal:Message.Attach="[Event MouseEnter] = [Action Talk(Hello, Name.Text)]; [Event MouseLeave] = [Action Talk(Goodbye, Name.Text)]" />
  18. 18. More Message.Attach• Other argument options – $eventArgs – $dataContext – $source – $view – $executionContext – $this
  19. 19. Event Aggregator• What is it? – Single source for communication across the application
  20. 20. Event Aggregator[Demo]
  21. 21. Window Manager• What is it? – It um… Manages Windows ;)• Use it to show a window, a dialog, or a popup
  22. 22. Window Manager[Demo]
  23. 23. ViewModel Types• Screen – Most basic ViewModel type – Implements basic ViewModely stuff • INotifyPropertyChanged• Conductor – Controls activation/deactivation of multi-Screen views – Has a collection of ViewModels to display
  24. 24. ViewModel Types[Demo]
  25. 25. Questions?
  26. 26. Brent EdwardsLead Consultant with MagenicBrentE@magenic.com@brentledwardsbrentedwards.nethttps://github.com/brentedwards

×