Displaying user Messages, Errors and Dialogs from a ViewModel using a Service – Part 2

Tuesday, December 18, 2012

Displaying user Messages, Errors and Dialogs from a ViewModel using a Service – Part 1In my previous post, I've discussed a bit about using the MVVM pattern and how to display a message or opening a dialog from within the view-model. As part of the discussion, I've shown a possible way for displaying Messages, Errors and even Dialog or Popups. In this post I would like to provide more details about the implementation of the Dialog part.  Recall previous post, we have the following two methods of the user interaction service:  bool? ShowDialog<TConductor>(string title) where TConductor : IDialogConductor;  bool? ShowDialog<TConductor, TParameters>(string title, TParameters parameters) where...
no comments

Displaying user Messages, Errors and Dialogs from a ViewModel using a Service – Part 1

Monday, December 17, 2012

Displaying user Messages, Errors and Dialogs from a ViewModel using a Service – Part 2 Years after the invention of the MVVM pattern and people are still asking many questions about how to do this and how to do that, and specifically, how to display a Message, Error or even opening a Dialog from a View Model without accessing the view layer or visual tree. If we go straight with the MVVM pattern concept, the view-model must not directly access or manipulate the View/Visual Tree or part of it in any circumstances. As many of you may already familiar...
4 comments

MVVM Open House at Sela Group, Haifa

Tuesday, October 11, 2011

To all of you who participated in the MVVM session today last week, I hope you've enjoyed it and learned something new. It was a great pleasure to speak in front of you. As I promised, here is the presentation. Also here is the Agenda for the 4 days Advanced WPF course at Sela Group.
no comments

Implicit DataTemplate in Silverlight 4 Composite UI – Get ready for Silverlight 5 (Part III)

Friday, June 17, 2011

In this post I'll show how did I implemented the ItemsControl implicit data-template using the ImplicitItemsTemplateBehavior attached behavior. But first, lets talk a bit about how WPF searches for an implicit data template, given a collection of items, so we can mimic that behavior in Silverlight. Having an ItemsControl with an ItemsSource property set to a collection of type Shape, WPF looks at the ItemsControl.ItemTemplate. In case that one is missing, and there is no ItemTemplateSelector, it changes strategy, and tries finding a Data Template by traversing upward the logical-tree, looking inside each element resource...

Implicit DataTemplate in Silverlight 4 Composite UI – Get ready for Silverlight 5 (Part II)

Sunday, May 22, 2011

In this post I'll show how did I implemented the ContentControl implicit data-template using the ImplicitContentTemplateBehavior attached behavior. But first, lets talk a bit about how WPF searches for an implicit data template, given a content, so we can mimic that behavior in Silverlight.   Having a ContentControl with a Content set to an instance of type Circle, WPF looks at the ControlControl.ItemTemplate. In case that one is missing, and there is no ItemTemplateSelector, it changes strategy, and tries finding a Data Template by traversing upward the logical-tree, looking inside each element resource dictionary for a...
2 comments

Implicit DataTemplate in Silverlight 4 Composite UI – Get ready for Silverlight 5 (Part I)

Tuesday, May 17, 2011

I'm using Prism 4 in one of my Silverlight 4 Composite UI. Working with Prism, there are two ways populating a Region: You can populate it with a UI element, which is the view, or placing the view-model directly. Personally I support the idea that a UI element must not be treated directly from the Application logic, and there should be ZERO UI elements in the Application logic. So natively, populating a region with a view-model instead of a view sounds more reasonable for me. With WPF things are easier. All you have to do is to create...
no comments

MVVM Open House at Sela Group

Tuesday, May 3, 2011

To all of you who participated in the MVVM session today I hope you've enjoyed it and learned something new. It was a great pleasure to speak in front of you. As I promised, here are the presentation and demo code. Also here is the Agenda for the 4 days Advanced WPF course at Sela Group.CodeProject
2 comments

Open Window, Dialog or Message Box from a ViewModel – part 2

Friday, April 1, 2011

In my previous post I have shown how to open a Window bound to a view-model triggered by the view, using a simple Action. In this post I'll show how to open a Window, triggered by the view-model.   Opening a window directly by the view where the view decides when a Window should be opened, is an incorrect approach since the view shouldn't make that decision. This decision belongs to the Application layer and not the Presentation layer. What if the view shouldn't be opened because of application state, user permissions or any other application...
one comment

Open Window, Dialog or Message Box from a ViewModel – part 1

Friday, March 25, 2011

Saying that a view-model belongs to the Application layer, and the Application layer doesn't references upper layers, and must not create or use visual objects, how can I open a Window, Dialog or any kind of Message Box on-the-fly, based on some logic triggered by the view or view-model? Well, there are several options doing that, one is using kind of service which encapsulates that, providing an interface, so the view-model don't really work directly with the upper layer or WPF. This solution is somehow problematic since the service should be implemented in the Presentation layer and...
2 comments

My Visual Studio 2010 SP1 Best Feature – Microsoft Help Viewer 1.1 for

Wednesday, March 16, 2011

As you may already know, Microsoft released the first service pack for Visual Studio 2010. And yes, there are tons of improvements, bug fixes, crash fixes and performance issues. I think SP1 is great for the developers and I really appreciate that.   One of the most annoying and frustrating features came out with Visual Studio 2010 is the poor web-based help center. Up until VS2010 came out we where used to have a great help viewer, and then Boom… it was gone!   Fortunately, the Microsoft Visual Studio Team heard our...
3 comments