From what I read in the description of Caliburn Micro, this code should be compiled without problems. Caliburn Description
<Button>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<cal:ActionMessage MethodName="AbrirPDF">
<cal:Parameter Value="{Binding CNPJ}"/>
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
When trying this, I get the following error:
ArgumentException: Cannot add instance of type 'ActionMessage' to a collection of type 'TriggerActionCollection'. Only items of type 'T' are allowed.
Could someone help me solve this problem?
You probably have the wrong namespace mappings. This should compile:
<UserControl x:Class="CaliburnMicroSample.Views.ShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cal="http://www.caliburnproject.org">
<StackPanel>
<Button>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<cal:ActionMessage MethodName="AbrirPDF">
<cal:Parameter Value="{Binding CNPJ}"/>
</cal:ActionMessage>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</StackPanel>
</UserControl>
The only installed NuGet package is Caliburn.Micro 3.2.0.