private void AddCurrentItemChangedListener()
{
Debug.Assert(IsSynchronizedWithCurrentItemInternal, "We should add currency change listeners only when IsSynchronizedWithCurrentItemInternal is true");
CollectionView = Items;
SourceCollectionView = RibbonGallery.GetSourceCollectionView(this);
if (SourceCollectionView == CollectionView.SourceCollection)
{
// We need to track the SourceCollectionView only if it
// is distinct from the immediate CollectionView
SourceCollectionView = null;
}
// Listen for currency changes on the immediate CollectionView for the Gallery
CurrentChangedEventManager.AddListener(CollectionView, this);
// Listen for currency changes on the Source CollectionView of the Gallery
if (SourceCollectionView != null)
{
CurrentChangedEventManager.AddListener(SourceCollectionView, this);
}
}