У меня есть пользовательский компонент с ContextMenu в ControlTemplate. Я прочитал несколько сообщений с людьми, которые не могут заставить свои действия работать в ContextMenu. Я пробовал обходные пути, размещенные там, но я не могу заставить его работать. Однако я все равно получаю No target found for method Open.
Однако ни одно из этих решений не использовало ControlTemplate. Я попытался привязать модель к контекстному меню, к элементам меню, использовать свойство TargetWithoutContext, но ни один из них не работает.Caliburn Micro Action в ContextMenu с ControlTemplate
<components2:ImageBlock Background="Transparent" x:Name="ShareButton" Margin="0,0,7,0" >
<components2:ImageBlock.Style>
<Style TargetType="{x:Type components2:ImageBlock }">
<Setter Property="ToolTipService.IsEnabled" Value="False"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type components2:ImageBlock }">
<Grid x:Name="ContentGrid" Background="{TemplateBinding Background}" MinHeight="30" ToolTip="{TemplateBinding ToolTip}">
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Header="Facebook" cal:Message.Attach="Open(0)"/>
<MenuItem Header="Twitter" cal:Message.Attach="Open(1)]" />
<MenuItem Header="Tumblr" cal:Message.Attach="Open(2)]" />
</ContextMenu>
</Grid.ContextMenu>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</components2:ImageBlock.Style>
</components2:ImageBlock>
Как я могу открыть Open для работы в моей модели просмотра за точкой зрения?
См. Ниже ...... –