private static void OnSynchronizedSelectedItemsChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { if (e.OldValue != null) { var synchronizer = GetSynchronizationManager(dependencyObject); synchronizer.StopSynchronizing(); SetSynchronizationManager(dependencyObject, null); } var list = e.NewValue as IList; var selector = dependencyObject as Selector; if (list != null && selector != null) { var synchronizer = GetSynchronizationManager(dependencyObject); if (synchronizer == null) { synchronizer = new SynchronizationManager(selector); SetSynchronizationManager(dependencyObject, synchronizer); } synchronizer.StartSynchronizingList(); } }
private static void SetSynchronizationManager(DependencyObject dependencyObject, SynchronizationManager value) { dependencyObject.SetValue(_synchronizationManagerProperty, value); }