【问题标题】:EventToCommand not coming with LightMvvm in WPF4 in .net 4 framework.net 4 框架中 WPF4 中的 LightMvvm 未附带 EventToCommand
【发布时间】:2013-09-27 09:53:15
【问题描述】:

我没有收到 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。欢迎任何帮助。谢谢,

【问题讨论】:

    标签: wpf mvvm mvvm-light mvvm-toolkit simple-mvvm


    【解决方案1】:

    按照here 的建议,EventToCommand 类位于Extras dll 中,所以我会尝试以下 xmlns:

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

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

    【讨论】:

    • 感谢您的回复。如您所见,我添加了一张我的参考图片。在我的 xaml 中,您可以看到我已经按照您的建议使用了 xmlns:LightCmd="galasoft.ch/mvvmlight"。
    • 我尝试了各种方法,但都不起作用。我也应用了你的代码。我有一个谦虚的请求,我可以将我的代码发送给你
    • @AnindyaChatterjee 当然:)
    【解决方案2】:

    直接使用怎么样:

    <i:InvokeCommandAction Command="{Binding YourCommand}" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-14
      • 1970-01-01
      • 2023-01-31
      • 1970-01-01
      相关资源
      最近更新 更多