Question

I'm trying to use a CallMethodAction bound to a control in a WPF Window, using the method from the Prism library samples and documentation. For some reason, the XAML compiler refuses to acknowldge that the Microsoft.Expression.Interactivity.Core namespace even exists. However, I have no problem using the same classes from the same namespace in the code-behind for that view.

In XAML I've tried both the canonical namespaces:

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ic="http://schemas.microsoft.com/expression/2010/interactions"

as well as the CLR namespace:

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"

The namespace Intellisense pop-up browser displays the first namespace but neither the XML nor CLR namespaces for the second. In either case, the following XAML fails to compile:

<Button HorizontalAlignment="Right" Content="Cancel">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Click">
            <ic:CallMethodAction />
        </i:EventTrigger>
    </i:Interaction.Triggers>
</Button>

It has no problem finding the Interaction.Triggers tag, but complains that the CallMethodAction tag doesn't exist in the specified namespace. In fact, Intellisense on the ic namespace tag acts as if there is no such namespace. However, I do not get the error that the CLR namespace could not be found, which I do if I try to use a non-existant namespace.

However, in the constructor for this window, I can do this:

var x = new Microsoft.Expression.Interactivity.Core.CallMethodAction();

That compiles and runs fine. How is that even possible?

Was it helpful?

Solution

Try removing and re-adding reference to Microsoft.Expression.Interactions.dll and *.Interactivity.dll

It happened to me once but I don't know why. This is the way I solved it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top