/// <summary> /// Selects everything between SelectionStart and the given item. /// </summary> internal void MultiSelectTo(TreeListViewItem to) { if (SelectionStart == null) return; var from = SelectionStart; bool inRange = false; foreach (var item in this.EnumerateItems(i => i.IsExpanded)) { if (item == to || item == from) { if (inRange) break; else inRange = true; } else if (inRange) item.IsMultiSelected = true; } to.IsMultiSelected = true; from.IsMultiSelected = true; }
internal void CleanupMultiSelects() { foreach (var item in MultiSelects.ToList()) { if (!item.IsSelected) { item.IsMultiSelected = false; if (item == SelectionStart) SelectionStart = null; } } }