In my WPF Caliburn.Micro application, I have a TabControl. I want to be able to close tabs as needed. I found a way to do it here:
But when I try to apply it, I get an error:
No target found for method CloseItem.
Here is my code:
<TabControl x:Name="Items" >
<TabControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding DisplayName}" />
<Button Content="X"
cal:Message.Attach="CloseItem($dataContext)" />
</StackPanel>
</DataTemplate>
</TabControl.ItemTemplate>
</TabControl>
Could you please help?
Thanks.