/// <summary> /// Raises behavior Attached event and performs custom actions</summary> /// <param name="addeditems">Items added to selection</param> /// <param name="removedItems">Items removed to selection</param> protected override void OnAssociatedObjectSelectionChanged(IList addeditems, IList removedItems) { base.OnAssociatedObjectSelectionChanged(addeditems, removedItems); if (!m_synchronising) { try { m_synchronising = true; if (SelectionContext != null) { if (removedItems.Count > 0) { var converted = ConvertToSelectionContext(removedItems); SelectionContext.RemoveRange(converted); } if (addeditems.Count > 0) { var converted = ConvertToSelectionContext(addeditems); SelectionContext.AddRange(converted); } } } finally { m_synchronising = false; } } }
/// <summary> /// Adds range of events to selection, from anchor to given target. /// Handles selecting an event (e.g., IInterval, IKey, IMarker), taking into account /// selecting ranges of tracks. /// If no anchor, just selects target.</summary> /// <param name="target">Timeline path</param> protected virtual void SelectEvents(TimelinePath target) { // add range of events, from anchor to target? if ((Control.ModifierKeys & Keys.Shift) != Keys.None) { if (Anchor != null && Anchor.Last is IEvent && SelectionContext != null) { SelectionContext.AddRange(GetRangeOfEvents(Anchor, target)); return; } } // simply add this target track, using the current modifier keys to determine how Owner.Select <IEvent>(target); }
/// <summary> /// Raises the AssociatedObjectSelectionChanged event and performs custom processing</summary> /// <param name="addeditems">Items added to selection</param> /// <param name="removedItems">Items removed to selection</param> protected override void OnAssociatedObjectSelectionChanged(IList addeditems, IList removedItems) { base.OnAssociatedObjectSelectionChanged(addeditems, removedItems); if (SelectionContext != null) { if (removedItems.Count > 0) { SelectionContext.RemoveRange(removedItems); } if (addeditems.Count > 0) { SelectionContext.AddRange(addeditems); } } }
/// <summary> /// Raises behavior Attached event and performs custom actions</summary> /// <param name="addeditems">Items added to selection</param> /// <param name="removedItems">Items removed to selection</param> protected override void OnAssociatedObjectSelectionChanged(IList addeditems, IList removedItems) { base.OnAssociatedObjectSelectionChanged(addeditems, removedItems); if (!m_synchronising) { try { m_synchronising = true; if (SelectionContext != null) { if (m_associatedObjectSelection != null) { // In muti select mode remove specific items if (removedItems.Count > 0) { var converted = ConvertToSelectionContext(removedItems); SelectionContext.RemoveRange(converted); } } else { // In single select mode always clear selection SelectionContext.Clear(); } if (addeditems.Count > 0) { var converted = ConvertToSelectionContext(addeditems); SelectionContext.AddRange(converted); } } } finally { m_synchronising = false; } } }