/// <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> /// 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; } } }