mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-01-13 17:22:48 -05:00
Keep selection when going to drag feeds
This commit is contained in:
@@ -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}"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user