WPF事件转Command

引入名称空间:

.net Framework :

 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

.Net Core:

  安装Nuget包 Microsoft.Xaml.Behaviors.Wpf

 xmlns:i="http://schemas.microsoft.com/xaml/behaviors"

使用:

<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding LoadingCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>

 

posted @ 2021-10-28 15:30  流沙河小妖  阅读(126)  评论(0编辑  收藏  举报