private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MyRibbonGalleryItem container = (MyRibbonGalleryItem)d; bool newValue = (bool)e.NewValue; MyRibbonGalleryCategory ribbonGalleryCategory = container.RibbonGalleryCategory; if (ribbonGalleryCategory == null) { return; } MyRibbonGallery ribbonGallery = ribbonGalleryCategory.RibbonGallery; if (ribbonGallery == null) { return; } object obj = ribbonGalleryCategory.ItemContainerGenerator.ItemFromContainer((DependencyObject)container); if (obj == DependencyProperty.UnsetValue) { obj = (object)container; } ribbonGallery.ChangeSelection(obj, container, newValue); Debug.WriteLine("hello"); }
/// <inheritdoc /> protected override void ClearContainerForItemOverride(DependencyObject element, object item) { base.ClearContainerForItemOverride(element, item); MyRibbonGalleryCategory ribbonGalleryCategory = (MyRibbonGalleryCategory)element; ribbonGalleryCategory.RibbonGallery = null; }
/// <inheritdoc /> protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { MyRibbonGalleryCategory ribbonGalleryCategory = (MyRibbonGalleryCategory)element; ribbonGalleryCategory.RibbonGallery = this; base.PrepareContainerForItemOverride(element, item); }
private void SynchronizeWithCurrentItem(MyRibbonGalleryCategory containerGalleryCategory, object item) { _SynchronizeWithCurrentItem?.Invoke(this, new object[] { containerGalleryCategory, item }); }