Skip to content

Commit

Permalink
Merge pull request #476 from tziemek/master
Browse files Browse the repository at this point in the history
Use explicit title for windows and pages
  • Loading branch information
nigel-sampson authored Sep 11, 2017
2 parents 392e75a + ae037e0 commit 7cb89b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Caliburn.Micro.Platform/net40/WindowManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected virtual Window CreateWindow(object rootModel, bool isDialog, object co
ViewModelBinder.Bind(rootModel, view, context);

var haveDisplayName = rootModel as IHaveDisplayName;
if (haveDisplayName != null && !ConventionManager.HasBinding(view, Window.TitleProperty)) {
if (string.IsNullOrEmpty(view.Title) && haveDisplayName != null && !ConventionManager.HasBinding(view, Window.TitleProperty)) {
var binding = new Binding("DisplayName") { Mode = BindingMode.TwoWay };
view.SetBinding(Window.TitleProperty, binding);
}
Expand Down Expand Up @@ -219,7 +219,7 @@ public virtual Page CreatePage(object rootModel, object context, IDictionary<str
ViewModelBinder.Bind(rootModel, view, context);

var haveDisplayName = rootModel as IHaveDisplayName;
if (haveDisplayName != null && !ConventionManager.HasBinding(view, Page.TitleProperty)) {
if (string.IsNullOrEmpty(view.Title) && haveDisplayName != null && !ConventionManager.HasBinding(view, Page.TitleProperty)) {
var binding = new Binding("DisplayName") { Mode = BindingMode.TwoWay };
view.SetBinding(Page.TitleProperty, binding);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Caliburn.Micro.Platform/sl4/WindowManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public virtual void ShowDialog(object rootModel, object context = null, IDiction
ViewModelBinder.Bind(rootModel, view, context);

var haveDisplayName = rootModel as IHaveDisplayName;
if(haveDisplayName != null && !ConventionManager.HasBinding(view, ChildWindow.TitleProperty)) {
if(string.IsNullOrEmpty(view.Title) && haveDisplayName != null && !ConventionManager.HasBinding(view, ChildWindow.TitleProperty)) {
var binding = new Binding("DisplayName") { Mode = BindingMode.TwoWay };
view.SetBinding(ChildWindow.TitleProperty, binding);
}
Expand Down

0 comments on commit 7cb89b3

Please sign in to comment.