48969

Clean separation of UI with Caliburn MVVM

Question:

Looking into various MVVM frameworks for SL. In the Caliburn documentation I saw a code in a controller that calls MessageBox. Is this right or is this just for intro? Is there something like MessageBox service in Caliburn like in Chinch MVVM?

Answer1:

It's indeed introductive code, just to demonstrate that the controller method is actually executed. Yet, I agree on the issue you pointed out: the presence of raw UI code in the presenter could lead to an inappropriate mix of view concerns.

About the MessageBox service: in Caliburn v2 (trunk), ShellFramework module, there is a Question/Answer ViewModel abstracting the functionality of a MessageBox, with the advantage of letting you to design the UI for the dialog. Also, it's very straightforward to roll your own IMessageBox abstraction and provide a basic implementation using the default WPF MessageBox.

Answer2:

Marco is correct. This is just to demonstrate that the action is called. I wouldn't recommend this in practice. I will try to make some changes to the samples or add some comments that make this clearer. Caliburn has services built-in for calling custom message boxes.

Recommend

  • Can we disable browser's buttons(back/forward/refresh) by javascript [duplicate]
  • Python: 3D column-major tensor to row-major
  • Set typed text in a JLabel
  • Windows Forms Form hanging after calling show from another thread
  • Error handling in WPF PasswordBox
  • Why do so many apps/frameworks keep their configuration files in an un-executed format?
  • Managing branches in subversion
  • CSS/XHTML Menu - Working in all browsers - IE6 Help
  • Validate HTML form with JQuery
  • Parent Child SQL Recursion
  • Django HTML truncation
  • Mongoid same embedded documents types for different fields
  • how to compile code from svn into jar file?
  • C++ face detection/recognition implementations
  • Use MongoDB array as stack
  • Unable to generate call to cell phone using asterisk
  • How to Moq this view?
  • Create ranking for vector of double
  • opengl: adding higher resolution mipmaps to a texture
  • How to remove trailing space from marquee?
  • How to make Javascript generated checkboxes persist?
  • Weird session behaviour in codeigniter
  • How to edit css for jquery datepicker prev/next buttons?
  • Getting IIS6 to play nice with WordPress Pretty Permalinks
  • Laravel lmutator $this->attributes return 'Undefined index: id'
  • How to set an entity field that does not exist on the table but does exists in the raw SQL as an ali
  • Count from each distinct date, fill in missing dates with zero
  • New Firebase failed: First argument must be a valid firebase URL and the path can't contain “.”
  • Using Generics on right hand side in Java 6?
  • Why does access(2) check for real and not effective UID?
  • Change JButton Shape while respecting Look And Feel
  • Projection media query: browser support and workarounds?
  • Display issues when we change from one jquery mobile page to another in firefox
  • Different response to non-authenticated users and AJAX calls
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • jQuery tmpl and DataLink beta
  • SVN: Merging two branches together
  • Data Validation Drop Down Box Arrow Disappearing
  • Unable to use reactive element in my shiny app