/// <summary>Constructor.</summary> /// <param name="contentTemplate">The XAML template of the dialog content (see 'Content' property).</param> /// <param name="contentViewModel">The view-model for the content (see 'Content' property).</param> public AcceptCancelDialogViewModel(DataTemplate contentTemplate, INotifyPropertyChanged contentViewModel) { // Store the presenter (use the given view-model if it happens to be a presenter). var modelAsPresenter = contentViewModel as IAcceptCancelPresenter; AcceptCancelPresenter = modelAsPresenter ?? new AcceptCancelPresenterEmbeddedViewModel(); // Store content. Content = new ViewTemplate(contentTemplate, contentViewModel); }
/// <summary>Constructor.</summary> public DialogContent() { // Setup initial conditions. Content = new ViewTemplate { ViewModel = this }; // Wire up events. propertyObserver = new PropertyObserver<DialogContent>(this) .RegisterHandler(m => m.Width, m => SyncSizeOnParent()) .RegisterHandler(m => m.Height, m => SyncSizeOnParent()); contentPropertyObserver = new PropertyObserver<IViewTemplate>(Content) .RegisterHandler(m => m.Template, m => SyncTemplateOnParent()); }