public GalleryCategories(IRibbonControl ribbonControl, IUICollection fromGallery) { if (ribbonControl == null) { throw new ArgumentNullException(nameof(ribbonControl)); } _ribbonControl = ribbonControl; if (fromGallery == null) { throw new ArgumentException(ribbonControl.ToString() + " not initialized"); } _collectionChanged = new UICollectionChangedEvent(); _collectionChanged.ChangedEvent += CollectionChanged_ChangedEvent; _collectionChanged.Attach(fromGallery); uint count; object item; fromGallery.GetCount(out count); for (uint i = 0; i < count; i++) { fromGallery.GetItem(i, out item); GalleryItemPropertySet galleryItem = GetItemPropertySet(item); _controlItems.Add(galleryItem); } }
public QatCommands(RibbonQuickAccessToolbar qat) { if (qat == null) { throw new ArgumentNullException(nameof(qat)); } IUICollection qatitemsSource = qat.ItemsSource; if (qatitemsSource == null) { throw new ArgumentException("Qat not initialized"); } _collectionChanged = new UICollectionChangedEvent(); _collectionChanged.ChangedEvent += CollectionChanged_ChangedEvent; _collectionChanged.Attach(qatitemsSource); uint count; object item; qatitemsSource.GetCount(out count); for (uint i = 0; i < count; i++) { qatitemsSource.GetItem(i, out item); GalleryCommandPropertySet galleryItem = GetCommandPropertySet(item); _controlCommands.Add(galleryItem); } }