public void ScrollIntoView(object item)
{
if (item != null)
{
// This is a fast path to scroll to the selected or the highlighted item
if (VerifyEqual(item, SelectedItem) && _selectedContainers.Count > 0)
{
_selectedContainers[0].BringIntoView();
}
else if (VerifyEqual(item, HighlightedItem) && _highlightedContainer != null)
{
_highlightedContainer.BringIntoView();
}
else
{
// If this a request for an arbitrary item then we need to
// find its container and then scroll that into view.
RibbonGalleryCategory category = null;
RibbonGalleryItem galleryItem = null;
bool ignoreItemContainerGeneratorStatus = true;
if (ContainsItem(item, ignoreItemContainerGeneratorStatus, out category, out galleryItem) &&
galleryItem != null)
{
galleryItem.BringIntoView();
}
}
}
}