我应该如何从 .net core 3.0 中的 WPF 绑定 xaml 事件?

ByB*_*Bye 3 c# wpf xaml binding .net-core

我应该如何在 netcore 3.0 中绑定事件?在 WPF 项目(netcore3.0)中,没有像 Interactive.dll 那样做

<i:Interaction.Triggers>
    <i:EventTrigger EventName="MouseDoubleClick">
        <i:InvokeCommandAction Command="{Binding Path=DoSomethingCommand}"/>
    </i:EventTrigger>
</i:Interaction.Triggers>
Run Code Online (Sandbox Code Playgroud)

那么如何在 WPF (netcore3.0) 中绑定事件?

And*_*ndy 6

您应该能够为此使用鼠标绑定。

  <YourControl.InputBindings>
      <MouseBinding MouseAction="LeftDoubleClick" Command="... />
  </YourControl.InputBindings>
Run Code Online (Sandbox Code Playgroud)

您现在打算使用该 dll 的方式是通过 nuget 包 - xaml bahaviors。

https://devblogs.microsoft.com/dotnet/open-sourcing-xaml-behaviors-for-wpf/

看到 net core 3 仍然只是预览版,我认为更新这个包可能还为时过早。

不过好像不是:

https://github.com/microsoft/XamlBehaviorsWpf/issues/13