protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); RibbonThumbnail tn = element as RibbonThumbnail; if (tn != null) { tn.Width = ThumbnailSize.Width; tn.Height = CalculateInRibbonThumbnailHeight(); Stretch stretch = RibbonGallery.GetStretch(this); RibbonGallery.SetStretch(tn, stretch); } }