// It just determines if any ancestor supports StarLayout and is not in StarLayoutPass mode. private bool IsAutoLayoutPass(double sumOfHeight, int childrenCount) { RibbonGalleryCategory category = (RibbonGalleryCategory)ItemsControl.GetItemsOwner(this); if (category != null) { // Adding virtual count of items and cumulative height to RGC for the purpose of calcualting // avg height as scrolling delta in RibbonGalleryCategoriesPanel. category.averageItemHeightInfo.count = childrenCount; category.averageItemHeightInfo.cumulativeHeight = sumOfHeight; RibbonGallery gallery = category.RibbonGallery; if (gallery != null) { RibbonGalleryCategoriesPanel categoriesPanel = (RibbonGalleryCategoriesPanel)gallery.ItemsHostSite; if (categoriesPanel != null) { IContainsStarLayoutManager iContainsStarLayoutManager = (IContainsStarLayoutManager)categoriesPanel; if (iContainsStarLayoutManager.StarLayoutManager != null) { return(!iContainsStarLayoutManager.StarLayoutManager.IsStarLayoutPass); } } } } return(false); }
private static void ResetScrolling(RibbonGalleryCategoriesPanel element) { element.InvalidateMeasure(); // Clear scrolling data. Because of thrash (being disconnected & reconnected, &c...), we may if (element.IsScrolling) { element._scrollData.ClearLayout(); } }