QuoteReplyTopic: Cocktail and Telerik Radwindows Posted: 15-Jan-2013 at 2:34am
Hi Another noob question , is their no sample on how Radwindow, Alert, Confirm, Prompt of telerik work in cocktail, or do i need to compile cocktails source with Caraulean framework http://nuget.org/packages/Caliburn.Micro.Telerik thanks
No, there is no official sample. However, we have several customers that use Cocktail with Telerik. You don't need to compile Cocktail with Caliburn.Micro.Telerik. CMT is complimentary to CM and you can simply add it to your project, install the conventions by calling TelerikConventions.Install() in StartRuntime of your bootstrapper and replace the WindowManager with the TelerikWindowManager as documented here.
By replacing the default WindowManager with the TelerikWindowsManager, the DialogManager will use the RadWindow for the popups.
If you are doing WPF, I believe you will need to customize the dialog host XAML as documented here, because the default XAML uses Window, which the TelerikWindowManager will then attempt to wrap in a RadWindow.
After I posted this I realized that you probably have to customize the XAML for Silverlight, too, if you develop for Silverlight. Both Window and ChildWindow are meant to be the root of a visual tree and don't behave properly as far as I remember if they are nested in another control.
It's been a while since I did this integration for a customer, so if you are running into trouble let me know.
Hi thanks the Main window shows up as a Radwindow, but when i call a dialog box i get an exception and cant trace were it is coming from, this is what i have done
AppBootstrapper
public class AppBootstrapper : Cocktail.CocktailMefBootstrapper<ViewModels.MainWindowViewModel> { protected override void StartRuntime() { base.StartRuntime(); StyleManager.ApplicationTheme = ThemeManager.FromName("Metro"); TelerikConventions.Install(); }
}
MainWindowViewModel
[Export] public class MainWindowViewModel : Screen { private readonly IDialogManager _dialogManager; private readonly NamePromptViewModel _namePrompt;
I thought that the CustomDialogView will be used for mainwindow, i changed MainwindowView to radwindow but still the exception pops up
The Exception is :
{"Object reference not set to an instance of an object."}
System.Reflection.TargetInvocationException was unhandled by user code HResult=-2146232828 Message=Exception has been thrown by the target of an invocation. Source=mscorlib StackTrace: at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Caliburn.Micro.ViewLocator.<.cctor>b__2(Type viewType) in c:\Projects\Caliburn.Micro\src\Caliburn.Micro.Silverlight\ViewLocator.cs:line 300 at Caliburn.Micro.ViewLocator.<.cctor>b__d(Type modelType, DependencyObject displayLocation, Object context) in c:\Projects\Caliburn.Micro\src\Caliburn.Micro.Silverlight\ViewLocator.cs:line 406 at Caliburn.Micro.ViewLocator.<.cctor>b__e(Object model, DependencyObject displayLocation, Object context) in c:\Projects\Caliburn.Micro\src\Caliburn.Micro.Silverlight\ViewLocator.cs:line 440 at Caliburn.Micro.TelerikWindowManager.CreateRadWindow(Object rootModel, Boolean isDialog, Object context, IDictionary`2 settings) in c:\Dev\cmt\WPF\Caliburn.Micro.Telerik\TelerikWindowManager.cs:line 67 at Caliburn.Micro.TelerikWindowManager.ShowDialog(Object rootModel, Object context, IDictionary`2 settings) in c:\Dev\cmt\WPF\Caliburn.Micro.Telerik\TelerikWindowManager.cs:line 21 at Cocktail.Dialog`1.Show() at Cocktail.DialogManager.ShowDialogAsync[T](IEnumerable`1 commands, Object content, String title) at Cocktail.DialogManager.ShowDialogAsync(Object content, IEnumerable`1 dialogButtons, String title) at Cocktail.DialogManager.ShowMessageAsync(String message, IEnumerable`1 dialogButtons, String title) at telerikCocktail.ViewModels.MainWindowViewModel.ShowDialog() in e:\code\Learning\newTutorial\Cocktail\telerikCocktail\telerikCocktail\ViewModels\MainWindowViewModel.cs:line 25 InnerException: System.NullReferenceException HResult=-2147467261 Message=Object reference not set to an instance of an object. Source=telerikCocktail StackTrace: at telerikCocktail.Views.CustomDialogView..ctor() in e:\code\Learning\newTutorial\Cocktail\telerikCocktail\telerikCocktail\Views\CustomDialogView.xaml.cs:line 18 InnerException:
Ok. Yeah from the exception it failed instantiating the view. I see you are doing Silverlight, so in that case the MainView should not be a RadWindow. I thought you were doing WPF. Change it back to UserControl. The CustomDialogView is only used for the popups.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum