Keep selection when going to drag feeds

This commit is contained in:
2016-05-31 10:31:45 -04:00
parent 42431a0066
commit d731945a71
2 changed files with 16 additions and 1 deletions

View File

@@ -28,7 +28,8 @@
CanUserResizeRows="False"
IsReadOnly="True"
HeadersVisibility="Column"
Background="{x:Null}">
Background="{x:Null}"
PreviewMouseLeftButtonDown="HandleFeedListPreviewMouseLeftButtonDown">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}"
Header="{x:Static properties:Resources.FeedNameColumnHeader}"

View File

@@ -6,6 +6,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml;
namespace FeedCenter.Options
@@ -433,5 +434,18 @@ namespace FeedCenter.Options
var bulkFeedWindow = new BulkFeedWindow();
bulkFeedWindow.Display(Window.GetWindow(this), Database);
}
private void HandleFeedListPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// Get the object that was clicked on
var originalSource = (DependencyObject) e.OriginalSource;
// Look for a row that contains the object
var dataGridRow = (DataGridRow) FeedListBox.ContainerFromElement(originalSource);
// If the selection already contains this row then ignore it
if (dataGridRow != null && FeedListBox.SelectedItems.Contains(dataGridRow.Item))
e.Handled = true;
}
}
}