我最近切换到 Visual Studio Premium 2012,并在 Silverlight 5 项目上使用 MVVM Light(v. 4.0.23.4)时发现 XAML 设计器问题。以下是触发问题的代码片段:
<sdk:AutoCompleteBox Text="{Binding Path=SomeProperty, Mode=TwoWay}" ItemsSource="{Binding Path=SomeCollectionProperty}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="KeyUp">
<mvvmlight:EventToCommand Command="{Binding Path=SomeRelayCommand}" CommandParameter="{Binding SomeParameter}" />
</i:EventTrigger>
</i:Interaction.Triggers>
相关的命名空间是:
xmlns:mvvmlight="http://www.galasoft.ch/mvvmlight"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
这会在设计器 View 上出现“无效标记”错误,并且“无法将“EventToCommand”类型的值添加到“TriggerActionCollection”类型的集合或字典 xaml 中的 EventToCommand 行出现错误。在 VS2010 中不会发生这种情况。
关于如何解决此问题有什么想法吗?
提前致谢!
最佳答案
艾丽丝解决问题。问题是 system.windows.interactivity,只需使用 nuget 更新此程序集即可工作:)
关于c# - 在 VS2012 中使用 EventToCommand 时出现 XAML "Invalid Markup"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12939743/