Skip to content

Commit

Permalink
Fixes #392 by forcing redraw of titlebar when title changes
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Jan 23, 2017
1 parent 2ed252e commit b61fe89
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- [#377](../../issues/377) - ToggleButton highlight doesn't match the button size
- [#388](../../issues/388) - QuickAccess item not visible when added from backstage
- [#391](../../issues/391) - QAT items not displayed properly if tab is made visible after initialization
- [#392](../../issues/392) - Change Window Title doesn't update Title length

- ### Enhancements
- [#250](../../issues/250) - Enable change/hide of window title foreground
Expand Down
11 changes: 11 additions & 0 deletions Fluent.Ribbon/Controls/RibbonWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ public bool IsAutomaticCollapseEnabled
static RibbonWindow()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(RibbonWindow), new FrameworkPropertyMetadata(typeof(RibbonWindow)));

TitleProperty.OverrideMetadata(typeof(RibbonWindow), new FrameworkPropertyMetadata(OnTitleChanged));
}

/// <summary>
Expand Down Expand Up @@ -342,5 +344,14 @@ internal T GetPart<T>(string name)
{
return this.GetTemplateChild(name) as T;
}

private static void OnTitleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ribbonWindow = (RibbonWindow)d;

ribbonWindow.TitleBar?.InvalidateMeasure();
ribbonWindow.TitleBar?.InvalidateArrange();
ribbonWindow.TitleBar?.UpdateLayout();
}
}
}

0 comments on commit b61fe89

Please sign in to comment.