Sep 16, 2010 at 3:19 AM
Edited Sep 16, 2010 at 5:04 AM
Been using Micro (SL) for a few weeks now, and so far its been awesome.
I'm having a small issue around the naming conventions used to create a ViewModels View. What I have done is created a generic control/view that I want to be able to use against a number of ViewModels and so obviously the VMs have various names which do
not quite match the required convention and the ViewLocator fails to load a view to bind against.
EDIT: Probably need to explain this a little more and describe what I have tried. The view that I am showing/wanting to show is opened as a modal window (I had it working in the base case where I had just the view and a single view model.
I have extended it by creating further ViewModels which allow the View to provide different sets of data and this is where I have found the problem). I have implemented an OpenModalResult IResult based on other samples in the wild (execute gets hold of window
manager and uses show dialog to open the view). I have attempted to override GetView provided by Screen to get around the problem, which works fine if not using a Modal view becuase the Parent is in place and Close works fine. However when using Modal this
doesn't work as TryClose gets a reference to my View rather than the ChildWindow it is hosted in and therefore cannot call Close. Here is the GetView override I have tried (I do feel that this is totally the wrong way of solving this problem but its the most
logical place I could find so far)
Hope this clarifies things a bit...
public override object GetView(object context)
var view = new AdvancedSearchView();
What would be the best approach to working around this?