WPF&MVVM:库 System.Windows.Interactivity 不再可用?

Gur*_*ofu 4 .net c# wpf xaml mvvm

我需要System.Windows.Interactivity.dll通过添加库Reference Manager。在Visual Studio 2017,我没有找到它。所有从以下位置开始的搜索结果System.Windows显示在下面的屏幕截图中:

在此输入图像描述

我认为该库已内置在当前 Visual Studio 版本的 WPF 项目中,因此当我添加以下C#代码时,IDE 没有显示任何警告:

private RelayCommand doubleCommand;
public RelayCommand DoubleCommand {
    get {
        return doubleCommand ??
        (doubleCommand = new RelayCommand(obj => {
            Phone phone = obj as Phone;
            if (phone != null) {
                Phone phoneCopy = new Phone {
                    Company = phone.Company,
                    Price = phone.Price,
                    Title = phone.Title
                };
                Phones.Insert(0, phoneCopy);
            }
        }));
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,当我添加以下XAML标记时,它表示Interaction,EventTrigger并且InvokeCommandAction尚未在clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity命名空间中找到:

<Window x:Class="MVVM_Tutorial.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:MVVM_Tutorial"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">

<!-- ... -->

    <Button Content="2x">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="MouseDoubleClick">
                <i:InvokeCommandAction
                    Command="{Binding DoubleCommand}"
                    CommandParameter="{Binding SelectedPhone}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </Button>

<!-- ... -->

</Window>
Run Code Online (Sandbox Code Playgroud)

与图书馆有关系System.Windows.Interactivity吗?我该如何解决这个问题?

Gur*_*ofu 5

目前,需要System.Windows.Interactivity.WPF通过 NuGet 包管理器添加。

在此输入图像描述