This project is read-only.

Collection of Opened views

Apr 8, 2011 at 4:22 PM

Is is possible to have a collection of 'opened' views on Bxf so the user can come back to these views and finish working on the Model?

This is to allow a 'Single' Document UI interface to have only one view opened on the screen but have others siting on the background and not lose the work already done on these.

Thank you

Apr 8, 2011 at 7:12 PM


When you use Bxf, you are the one that implements the event handlers from the IPresenter interface. You typically do this in your main presenter/viewmodel object for the application.

Notice that in the OnShowView event handler, it is your code that actually shows the view. Therefore it is your code that knows which views are currently active.

In your code, you can define a collection of IView, and maintain that collection as your OnShowView method shows and removes each view from display.

Apr 8, 2011 at 7:49 PM


Thank you for your response.

I'm a little confused as to how this will be implemented, i might not be fully understanding the concepts here but please bear with me.

For what I can see OnShowView accepts an IView parameter that gets created by Shell.Show -> ViewFactory.GetView. This method creates a new instance of IView (in turn creating a new instance of its Model). This will mean that by the time the OnShowView handler on the Presenter gets executed we'll always have a brand new instance of a IView, which is what I don't want to happen. I of course can ignore that instance but use it's information to find the existing one on my collection but I feels a little wasteful to do all that process.

Is this how I should about it?

Thank you

Apr 8, 2011 at 8:54 PM

I think I understand better now.

In this case you need to create a custom view factory. The default view factory takes the assembly qualified type name of the view, creates an instance of that type, and returns the result.

You just need to create your own view factory - probably by subclassing Bxf.ViewFactory, or by implementing IViewFactory directly.

Your view factory may act in a similar manner, but would presumably check your list of existing views and return an existing instance if one is in the list - something like that.