private static void OnTimeFrameCollectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TimelineBand timelineBand = d as TimelineBand; if (timelineBand == null) { return; } ObservableCollection <ITimeRange> oldTimeFrameCollection = e.OldValue as ObservableCollection <ITimeRange>; if (oldTimeFrameCollection != null) { oldTimeFrameCollection.CollectionChanged -= timelineBand.TimeFrameCollection_CollectionChanged; } ObservableCollection <ITimeRange> newTimeFrameCollection = e.NewValue as ObservableCollection <ITimeRange>; if (newTimeFrameCollection != null) { newTimeFrameCollection.CollectionChanged += timelineBand.TimeFrameCollection_CollectionChanged;; } if (timelineBand._isLoaded) { timelineBand.InitTimeFrameElements(); } }
private static void OnCurrentDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TimelineBand timelineBand = d as TimelineBand; if (timelineBand == null) { return; } DateTime oldDateTime = (DateTime)e.OldValue; DateTime newDateTime = (DateTime)e.NewValue; timelineBand.UpdateTimelineBandElementsPositionByDateTime(oldDateTime, newDateTime); if (timelineBand.HostTimeline != null) { timelineBand.HostTimeline.CurrentDateTime = timelineBand.CurrentDateTime; } }
private void HookTimelineBands(object element) { if (element is TimelineBand) { TimelineBand timelineBand = element as TimelineBand; timelineBand.HostTimeline = this; if (timelineBand.IsMainBand && _mainTimelineBand == null) { _mainTimelineBand = timelineBand; } } else if (element is Panel) { Panel panel = element as Panel; foreach (object childElement in panel.Children) { HookTimelineBands(childElement); } } }