enhance: make sure mouse is hover commit row (not empty area or headers in DataGrid) when trying to open context menu

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2025-06-30 20:40:04 +08:00
parent cbee179b5e
commit ae9ce331dc

View File

@@ -199,11 +199,14 @@ namespace SourceGit.Views
private void OnCommitListContextRequested(object sender, ContextRequestedEventArgs e)
{
if (DataContext is ViewModels.Histories histories && sender is DataGrid { SelectedItems.Count: > 0 } dataGrid)
if (DataContext is ViewModels.Histories histories &&
sender is DataGrid { SelectedItems.Count: > 0 } dataGrid &&
e.Source is Control { DataContext: Models.Commit })
{
var menu = histories.MakeContextMenu(dataGrid);
menu?.Open(dataGrid);
}
e.Handled = true;
}