public void selectNone() { if (_selectedMappings.Count > 0) { SelectedMappings.Clear(); } }
private void paste() { var sorted = _selectedMappings.OrderBy(s => _mappings.IndexOf(s)); int index = _mappings.Count; if (_selectedMappings.Count > 0) { index = _mappings.IndexOf(sorted.Last()) + 1; if (can_change_selection_automatically()) { SelectedMappings.Clear(); } } foreach (var mapping in _mappingClipboard) { var new_map = mapping.Copy(true); insertMapping(index++, new_map); } if (can_change_selection_automatically()) { _selectedMappings.Last().BringIntoView(); } var all_mappings = _mappings.Count; var all_selected_mappings = _selectedMappings.Count; OnModification(); }
private void selectExclusive(RowItemViewModel row) { if (can_change_selection_automatically()) { SelectedMappings.Clear(); SelectedMappings.Add(row); } }
private void paste() { var sorted = _selectedMappings.OrderBy(s => _mappings.IndexOf(s)); int index = _mappings.Count; if (_selectedMappings.Count > 0) { index = _mappings.IndexOf(sorted.Last()) + 1; SelectedMappings.Clear(); } foreach (var mapping in _mappingClipboard) { insertMapping(index++, mapping.Copy(true)); } _selectedMappings.Last().BringIntoView(); }
private void paste() { var sorted = _selectedMappings.OrderBy(s => _mappings.IndexOf(s)); int index = _mappings.Count; if (_selectedMappings.Count > 0) { index = _mappings.IndexOf(sorted.Last()) + 1; SelectedMappings.Clear(); } foreach (var mapping in _mappingClipboard) { insertMapping(index++, mapping.Copy(true)); } _selectedMappings.Last().BringIntoView(); Mappings.First().ClearFiltering(); // HACK: investigate why there is a duplication on the very first paste or "add-in". Clearing grid filters avoids this bug }
private void selectExclusive(RowItemViewModel row) { SelectedMappings.Clear(); SelectedMappings.Add(row); }
private void drop(IDataObject dataObject) { if (dataObject == null) { return; } var data = dataObject.GetData(typeof(DraggableRowsBehavior.Data)) as DraggableRowsBehavior.Data; if (data == null) { return; } if (data.TargetIndex < 0 && Mappings.Any()) // // don't allow invalid targets, but allow drop on an empty grid { return; } DeviceViewModel srcDevice = data.SenderDataContext as DeviceViewModel; if (srcDevice == null) { return; } // copy and sort selected items List <RowItemViewModel> selected = new List <RowItemViewModel>( data.SelectedItems .Cast <RowItemViewModel>() .OrderBy(s => srcDevice._mappings.IndexOf(s)) ); int newIndex = Math.Max(0, data.TargetIndex); if (srcDevice != this || !data.IsMove) { if (data.IsMove) { srcDevice.removeMappings(selected); } SelectedMappings.Clear(); foreach (var row in selected) { var rawMapping = (row.Item as MappingViewModel).Copy(true); insertMapping(newIndex++, rawMapping); } } else { var movingAction = new Action <int, int>((oi, ni) => { _device.MoveMapping(oi, ni); _mappings.Move(oi, ni); }); MovingLogicHelper.Move <RowItemViewModel>(_mappings, selected, newIndex, movingAction); } if (selected.Any()) { selected.Last().BringIntoView(); } }