c# - 我应该如何在 .net core 3.0 中绑定(bind)来自 WPF 的 xaml 事件?

标签 c# wpf xaml .net-core binding

我应该如何在 netcore 3.0 中绑定(bind)事件?
在 WPF 项目(netcore3.0)中,没有类似的 Interactive.dll

<i:Interaction.Triggers>
    <i:EventTrigger EventName="MouseDoubleClick">
        <i:InvokeCommandAction Command="{Binding Path=DoSomethingCommand}"/>
    </i:EventTrigger>
</i:Interaction.Triggers>

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

最佳答案

您应该可以为此使用鼠标绑定(bind)。

  <YourControl.InputBindings>
      <MouseBinding MouseAction="LeftDoubleClick" Command="... />
  </YourControl.InputBindings>

您现在打算使用该 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

关于c# - 我应该如何在 .net core 3.0 中绑定(bind)来自 WPF 的 xaml 事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56274569/

相关文章:

c# - 处理 json 写入文件的 WebAPI Controller

c# - 在内存中保留对象特定时间(C# WinForms 应用程序)

c# - WPF:自动截断 TextBlock 中的文本

c# - 使用 WPF 按钮复制和粘贴命令

c# - WPF 滚动条样式

C# 无法在未损坏的 C++ 库上找到入口点

c# - 在默认浏览器中运行selenium?

c# - 将数据异步加载到数据网格中

c# - WPF:静态资源与资源字典?

wpf - WPF用户控件: Image disappears even with 'x:Shared=“False” '