New Posts New Posts RSS Feed: Cannot find view for Cocktail.DialogBase
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Cannot find view for Cocktail.DialogBase

 Post Reply Post Reply
Author
-ook View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Aug-2007
Location: Australia
Posts: 41
Post Options Post Options   Quote -ook Quote  Post ReplyReply Direct Link To This Post Topic: Cannot find view for Cocktail.DialogBase
    Posted: 04-Feb-2013 at 8:40pm

I have followed the advice in the Dialogs and Messageboxes topic on the Ideablade website in order to create a simple Dialog Box with its own viewmodel and view.


After I issue the command: "await _dialogManager.ShowDialogAsync(_namePrompt, DialogButtons.OkCancel);" I get back the error "Cannot find view for Cocktail.DialogHostBase", also in the VS 2012 output window is:

System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=DisplayName; DataItem='DialogHostBase' (HashCode=43089040); target element is 'Window' (Name=''); target property is 'Title' (type 'String')

The ViewModel and View correctly follow the naming conventions. As a test I can display the control in question embedded on a MainPage - this confirms that Caliburn Micro can fins the view from the viewmodel normally, it just does not work from the dialog manager.

 
Any ideas?
Back to Top
-ook View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Aug-2007
Location: Australia
Posts: 41
Post Options Post Options   Quote -ook Quote  Post ReplyReply Direct Link To This Post Posted: 04-Feb-2013 at 8:50pm
Nevermind, found out one has to define a custom Cocktail.DialogHostView before it works.
 
 
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 04-Feb-2013 at 10:29pm
I'm a bit confused. Did you subclass Cocktail.DialogHostBase? You only need to do that if you plan on customizing the dialog host. This is not required for a simple dialog. All you have to do is create a ViewModel and View for the content you want to display in the dialog and call _dialogManager.ShowDialogAsync() with it. Cocktail will do the rest. If you look at TempHire you won't find a custom DialogHostView.
Back to Top
-ook View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Aug-2007
Location: Australia
Posts: 41
Post Options Post Options   Quote -ook Quote  Post ReplyReply Direct Link To This Post Posted: 04-Feb-2013 at 11:09pm
I agree with it being confusing. I have not sub classes the DialogHostBase or anything like that, the implementation is as per the example provided here.  It appears the Cocktail.DialogHostView cannot be found in the nuget cocktail packages, I downloaded the Cocktail source code and copied Cocktail.DialogHostView.xaml to my project and now it works.


Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 05-Feb-2013 at 5:57am
Here's the example in form of a WPF application. It works as expected. I'm not sure what's going wrong in your case. Maybe you can compare the sample to what you have. Something must be different. The solution should automatically download the necessary NuGet packages when you build. If you get an error, make sure you allow NuGet to download missing packages in the Package Manager Settings.

http://sdrv.ms/12pLbJU

Back to Top
-ook View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Aug-2007
Location: Australia
Posts: 41
Post Options Post Options   Quote -ook Quote  Post ReplyReply Direct Link To This Post Posted: 19-Feb-2013 at 8:19pm
Turns out I had excluded the Cocktail.dll's using IdeaBlade.Core.Composition.CompositionHost.SearchPatterns.Add. Silly mistake.
Thanks for your help.
 
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 19-Feb-2013 at 9:50pm
Thanks for letting me know. Cocktail is supposed to always be included even if you change the SearchPatterns. Sounds like that isn't working anymore. Something to investigate I suppose. 
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 21-Feb-2013 at 5:24pm
This will be fixed in the upcoming 2.2.1 release. It will always ensure that Cocktail.dll is included in the catalog.

Edited by mgood - 21-Feb-2013 at 5:24pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down