Skip to content

Commit

Permalink
Adding special keytip handling for StartScreen (fixes #280)
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Mar 4, 2016
1 parent d425d94 commit ba5e9c0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
- [#269](../../issues/269) - Show underscore of header text on RibbonTabItem
- [#272](../../issues/272) - Changing RibbonThemeColorBrush does not change background of ItemsPanel in Backstage
- [#274](../../issues/274) - RadioButton Icon and LargeIcon
- [#280](../../issues/280) - Keytips of the Ribbon overlay StartScreen
- OpenBackstage command was not acting on the correct backstage in a multiple backstage scenario (thanks to @maurosampietro)

- ### Enhancements
Expand Down
23 changes: 19 additions & 4 deletions Fluent.Ribbon/Services/KeyTipService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ private void Show()

// Special behavior for backstage
var specialControl = this.GetBackstage()
?? (DependencyObject)this.GetApplicationMenu();
?? this.GetApplicationMenu()
?? this.GetStartScreen();

if (specialControl != null)
{
Expand All @@ -407,14 +408,14 @@ private void Show()
}
}

private Backstage GetBackstage()
private DependencyObject GetBackstage()
{
if (this.ribbon.Menu == null)
{
return null;
}

var control = this.ribbon.Menu as Backstage ?? UIHelper.FindImmediateVisualChild<Backstage>(this.ribbon.Menu, obj => obj.Visibility == Visibility.Visible && obj.IsOpen);
var control = this.ribbon.Menu as Backstage ?? UIHelper.FindImmediateVisualChild<Backstage>(this.ribbon.Menu, obj => obj.Visibility == Visibility.Visible);

if (control == null)
{
Expand All @@ -426,7 +427,7 @@ private Backstage GetBackstage()
: null;
}

private ApplicationMenu GetApplicationMenu()
private DependencyObject GetApplicationMenu()
{
if (this.ribbon.Menu == null)
{
Expand All @@ -445,6 +446,20 @@ private ApplicationMenu GetApplicationMenu()
: null;
}

private DependencyObject GetStartScreen()
{
var control = this.ribbon.StartScreen;

if (control == null)
{
return null;
}

return control.IsOpen
? control
: null;
}

private void DirectlyForwardToSpecialControl(DependencyObject specialControl)
{
var keys = KeyTip.GetKeys(specialControl);
Expand Down

0 comments on commit ba5e9c0

Please sign in to comment.