Search code examples
c#silverlightvisual-studio-2012mvvm-lightsilverlight-5.0

XAML "Invalid Markup" error when using EventToCommand in VS2012


I have recently switched to Visual Studio Premium 2012, and discovered a XAML designer issue while using MVVM Light (v. 4.0.23.4) on a Silverlight 5 project. Here is the snippet of code that triggers the issue:

<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>

The relevant namespaces are:

xmlns:mvvmlight="http://www.galasoft.ch/mvvmlight"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

This gives me an "Invalid Markup" error on the designer view and a "A value of type 'EventToCommand' cannot be added to a collection or dictionary of type 'TriggerActionCollection' error on the EventToCommand line in the xaml. This does not happen in VS2010.

Any ideas on how to fix this issue?

Thanks in advance!


Solution

  • Alyce solve the problem. The problem was the system.windows.interactivity, just use nuget to update this assembly and it will works :)