void OnGalleryGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
// When on of the GalleryItems within the _firstGallery acquires Keyboard
// focus reinstate focus to the parent based on the IsEditable mode
RibbonGalleryItem focusedGalleryItem = Keyboard.FocusedElement as RibbonGalleryItem;
if (focusedGalleryItem != null)
{
if (IsEditable && EditableTextBoxSite != null)
{
EditableTextBoxSite.Focus();
}
else if (!IsEditable && PartToggleButton != null)
{
PartToggleButton.Focus();
}
else
{
Focus();
}
}
}