2

我没有收到 EventToCommand。我的组装如下

<Window x:Class="EfesBetGUI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vmMainWindow="clr-namespace:EfesBetGUI.ViewModel"
        xmlns:DateTimeUC="clr-namespace:EfesBetGUI.View.UserControls"        
        xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        xmlns:ei="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
        xmlns:cmd="clr-namespace:GalaSoft.MvvmLight;assembly=GalaSoft.MvvmLight.WPF4"
        xmlns:mvvmgalasoftCommand="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.WPF4"
        xmlns:LightCmd="http://www.galasoft.ch/mvvmlight"
        xmlns:util="clr-namespace:EfesBetGUI.Util"
        Title="MainWindow" >

但尽管如此,我也没有得到 EventToCommand 。我想提一下我正在使用框架 4.0 和 Visual Studio 12。欢迎任何帮助。谢谢, 在此处输入图像描述

4

2 回答 2

2

正如这里所建议的,EventToCommand该类位于Extrasdll 中,所以我会尝试以下 xmlns:

xmlns:mvvmgalasoftCommand="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"

请注意,我已Extras在程序集名称中添加了 。不确定你是否需要WPF4后缀,你可以试试有/没有它,看看它是否有效

于 2013-09-22T11:33:47.483 回答
1

直接使用如何:

<i:InvokeCommandAction Command="{Binding YourCommand}" />
于 2016-03-16T18:35:29.647 回答