/// <summary> /// Creates a window. /// </summary> /// <param name="rootModel">The view model.</param> /// <param name="isDialog">Whethor or not the window is being shown as a dialog.</param> /// <param name="context">The view context.</param> /// <param name="settings">The optional popup settings.</param> /// <returns>The window.</returns> protected virtual Window CreateWindow(object rootModel, bool isDialog, string context, IDictionary <string, object> settings) { var view = EnsureWindow(rootModel, _viewModelLocator.LocateForModel(rootModel, context), isDialog); _viewModelBinder.Bind(rootModel, view, context); var haveDisplayName = rootModel as IHaveDisplayName; if (haveDisplayName != null && !BindingHelper.IsDataBound(view, Window.TitleProperty)) { var binding = new Binding("DisplayName") { Mode = BindingMode.OneWay }; view.SetBinding(Window.TitleProperty, binding); } ApplySettings(view, settings); var conductor = new WindowConductor(rootModel, view); return(conductor.View); }
/// <summary> /// Creates a window. /// </summary> /// <param name="rootModel">The view model.</param> /// <param name="isDialog">Whethor or not the window is being shown as a dialog.</param> /// <param name="context">The view context.</param> /// <param name="settings">The optional popup settings.</param> /// <returns>The window.</returns> protected virtual Window CreateWindow(object rootModel, bool isDialog, string context, IDictionary<string, object> settings) { var view = EnsureWindow(rootModel, _viewModelLocator.LocateForModel(rootModel, context), isDialog); _viewModelBinder.Bind(rootModel, view, context); var haveDisplayName = rootModel as IHaveDisplayName; if (haveDisplayName != null && !BindingHelper.IsDataBound(view, Window.TitleProperty)) { var binding = new Binding("DisplayName") {Mode = BindingMode.OneWay}; view.SetBinding(Window.TitleProperty, binding); } ApplySettings(view, settings); var conductor = new WindowConductor(rootModel, view); return conductor.View; }