private static void OnNotifyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
RibbonGalleryCategory galleryCategory = (RibbonGalleryCategory)d;
galleryCategory.NotifyPropertyChanged(e);
// This is for the layout related properties MinColumnCount/MaxColumnCount IsSharedColumnScope
// and MaxColumnWidth on RibbonGallery/RibbonGalleryCategory. This calls InvalidateMeasure
// for all the categories' ItemsPanel and they must use changed values.
if (e.Property == MinColumnCountProperty || e.Property == MaxColumnCountProperty || e.Property == IsSharedColumnSizeScopeProperty || e.Property == ColumnsStretchToFillProperty)
{
RibbonGallery gallery = galleryCategory.RibbonGallery;
if (gallery != null)
{
gallery.InvalidateMeasureOnAllCategoriesPanel();
}
}
}