Show a Modal Dialog

Show a Modal Dialog

Old forum URL: forums.lhotka.net/forums/t/10934.aspx


st3fanus posted on Wednesday, November 30, 2011

Hi Rocky..

I'm sorry before that I post on this forum, because I'm fell happy with this community.

First I'm quoted your statement from :

http://bxf.codeplex.com/discussions/239182

/////////

The basic design of Bxf places responsibility for creating the view in the view factory, and for displaying the view within a "container" in the code that handles the IPresenter events (i.e. your shell).

For a modal dialog, or any other dialog, your shell code (the IPresenter handlers) needs to supply the "container" that displays the view. In WPF this container is typically a Window that contains a ContentControl, and that is displayed modally. Literally, you should create a "ModalDialog" window .xaml file, and your OnShowView code will modally display an instance of ModalDialog.

The view is no different than any view. All views are UserControl objects that can be hosted in a container. It doesn't matter if the view will be in a modal window or in a region of an existing window - the view shouldn't care how/where it is displayed.

This means that the code in OnShowView will do the following:

  1. Create an instance of the ModalDialog container window
  2. Set the ModalDialog object's Content property (or whatever you call the property used to set the content of the container's ContentControl.Content property) to the view.ViewInstance
  3. Modally display/show the ModalDialog container window

///////////

I'm confuse with point no 1 until 3 => Why Presenter Display a view /  concrete window ??

and How do if us want to test it ? ( It will stop automatic unit test  ? )

why viewmodel has a responsibilty to display a concrete window ( view ) ??

 

thanks a lot

 

RockfordLhotka replied on Thursday, December 01, 2011

As this is a pure bxf question, it should go in the bxf forum on codeplex.

Copyright (c) Marimer LLC