sourcegit/src/Views/CommitChanges.axaml.cs

26 lines
676 B
C#
Raw Normal View History

using Avalonia.Controls;
namespace SourceGit.Views
{
public partial class CommitChanges : UserControl
{
public CommitChanges()
{
InitializeComponent();
}
private void OnChangeContextRequested(object sender, ContextRequestedEventArgs e)
{
2024-07-14 00:55:15 -07:00
if (sender is ChangeCollectionView { SelectedChanges: { } selected } view &&
selected.Count == 1 &&
DataContext is ViewModels.CommitDetail vm)
{
2024-07-14 00:55:15 -07:00
var menu = vm.CreateChangeContextMenu(selected[0]);
view.OpenContextMenu(menu);
}
e.Handled = true;
}
}
}