本文介绍了MVVM EventToCommand未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好,我想在一个列表框的项目点击效果器的,但我不断收到此错误:Hi all I am trying to implement an on click effect in the items of a listbox but I keep getting this error:键入CMD:EventToCommand是未找到。 。确保你是不是缺少程序集引用,并且所有引用的程序已建成The type 'cmd:EventToCommand' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.<catel:UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:catel="http://catel.codeplex.com" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:cmd="http://www.galasoft.ch/mvvmlight" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">和在那里我尝试实施上点击方法的代码:And the code where I try to implement the on click method:<Grid> <ItemsControl ItemsSource="{Binding Source={StaticResource cvsRoutes}}"> <ItemsControl.ItemTemplate> <DataTemplate> <Expander Header="{Binding Name}" MinHeight="50"> <ListBox> <i:Interaction.Triggers> <i:EventTrigger EventName="PreviewMouseLeftButtonDown"> <cmd:EventToCommand Command="{Binding PreviewMouseLeftButtonDownCommand}" PassEventArgsToCommand="True"/> </i:EventTrigger> </i:Interaction.Triggers> <TextBlock Text="Something" > <i:Interaction.Triggers> <i:EventTrigger EventName="KeyUp"> <cmd:EventToCommand Command="{Binding KeyUpCommand}" PassEventArgsToCommand="True"/> </i:EventTrigger> </i:Interaction.Triggers> </TextBlock> <TextBlock Text="Something" /> <TextBlock Text="Something" /> <TextBlock Text="Something" /> <TextBlock Text="Something" /> </ListBox> </Expander> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl></Grid>您能告诉我是什么问题以及如何解决这个问题?Can you tell me what is the problem and how can I fix it?推荐答案有是,在Catel可用,如何使用他们的所有行为和触发器的一个很好的列表:There is a good list of all behaviors and triggers that are available in Catel and how you can use them: https://catelproject.atlassian.net/wiki /pages/viewpage.action?pageId=1409064 还包括EventToCommand:It also includes EventToCommand: https://catelproject.atlassian.net/wiki/display/CTL/EventToCommand 这篇关于MVVM EventToCommand未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-27 14:14