public static EventTranscriptionsCollection GetTranscriptions(DependencyObject dpObject) { if (dpObject == null) throw new InvalidOperationException("The dependency object trying to attach to is set to null"); var collection = dpObject.GetValue(EventTranscriptions.TranscriptionsProperty) as EventTranscriptionsCollection; if (collection == null) { collection = new EventTranscriptionsCollection(); collection.Owner = dpObject; SetTranscriptions(dpObject, collection); } return collection; }
private static void SetTranscriptions(DependencyObject dpObject, EventTranscriptionsCollection value) { dpObject.SetValue(TranscriptionsPropertyKey, value); var collection = (INotifyCollectionChanged)value; collection.CollectionChanged += new NotifyCollectionChangedEventHandler(CollectionChanged); }