private void ShiftSelectItems(ITreeItem startItem, ITreeItem endItem) { //Unselect SelectedItemSet.UnselectItems(); //Select SelectedItemSet.AddSelectedItem(startItem); ITreeItem[] items = CollectItems(); int startIndex = Array.IndexOf(items, startItem); int endIndex = Array.IndexOf(items, endItem); if (startIndex > endIndex) { int tempValue = endIndex; endIndex = startIndex; startIndex = tempValue; } for (int i = startIndex; i <= endIndex; ++i) { ITreeItem targetItem = items[i]; if (targetItem != startItem) { if (SelectedItemSet.Contains(targetItem)) { SelectedItemSet.RemoveSelectedItem(targetItem); } else { SelectedItemSet.AddSelectedItem(targetItem); } } } }
private void Background_MouseDown(object sender, MouseButtonEventArgs e) { SelectedItemSet.UnselectItems(); }