Okra Search

Oct 8, 2012 at 11:02 PM

I read in another post you had some documentation coming on Search... any word on an ETA?  I was running into issues trying to get search to work.  I finally did, but what is odd to me is I cannot have any parameters in my SearchResultsViewModel constructor?  Why is this?  If I throw in an INavigationManager to the constructor, when I try to search it completely ignores the VM and never creates it.  As soon as I take it away everything works as expected.  Why?  Wouldn't I want to navigate somewhere else when clicking on a searched item?  How do you handle this?

Coordinator
Oct 9, 2012 at 1:12 PM

Hi,

I'm currently trying to get my own app finished and into the store so documentation/sample writing has been put on hold for a bit - hope to do this one day!

Regarding your issue, this should work fine (it is how I handle this in my own apps). As a first thought have you marked your constructor with the INavigationManager with the [ImportingConstructor] attribute? As far as I am aware MEF will automatically use parameterless constructors, but if you have parameters you need to explicitly say which one to use when composing.

public class MyViewModel
{
    [ImportingConstructor]
    public MyViewModel(INavigationManager navigationManager)
    {
        ...
    }
}

Let me know how you get on,

Andy

Oct 9, 2012 at 2:47 PM

Hey Andy,

Thanks for following up with these discussion posts... nice to know Okra's being supported so promptly!  I found my error late last night (not related to Okra).  Thanks for the reply though.  The more I use Okra the more it makes sense and the more I like it.  I have two other apps I'm working on, and I'm definitely going to be moving them to Okra as well.  I've created a nice base framework using MVVM Light, Okra, and some extra pizzaz from me for Charms and the Application Bar, so thanks for your part in that! Keep up the good work.

-Andy