diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs index 4cfae6df6f..c3e4f7f573 100644 --- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs @@ -556,9 +556,16 @@ namespace MaaWpfGui.ViewModels.UI // UI 绑定的方法 [UsedImplicitly] - public void SelectCopilotTask(int index) + public void SelectCopilotTask(object? sender, MouseButtonEventArgs? e = null) { - Filename = CopilotItemViewModels[index].FilePath; + if (e?.Source is FrameworkElement element && element.Tag is int index) + { + Filename = CopilotItemViewModels[index].FilePath; // 假设原方法接受int参数 + if (e.ChangedButton == MouseButton.Left) + { + UseCopilotList = false; + } + } } // UI 绑定的方法 diff --git a/src/MaaWpfGui/Views/UI/CopilotView.xaml b/src/MaaWpfGui/Views/UI/CopilotView.xaml index 65661beb2f..66314d2405 100644 --- a/src/MaaWpfGui/Views/UI/CopilotView.xaml +++ b/src/MaaWpfGui/Views/UI/CopilotView.xaml @@ -306,7 +306,7 @@ IsEnabled="{Binding ElementName=CopilotList, Path=DataContext.Idle}" IsHitTestVisible="{Binding ElementName=CopilotList, Path=DataContext.Idle}" ToolTip="{c:Binding CopilotId}"> - + + IsEnabled="{Binding ElementName=CopilotList, Path=DataContext.Idle}" + MouseRightButtonUp="{s:Action SelectCopilotTask}" + PreviewMouseLeftButtonUp="{s:Action SelectCopilotTask}" + Tag="{c:Binding Index}" />