I have a Menu which has an ItemContainerStyle
<Menu DockPanel.Dock="Top" ItemContainerStyle="{StaticResource MenuItemStyle}" ItemsSource="{Binding MenuItems}">
This particoular ItemContainerStyle has a trigger defined like in How can I bind key gestures in Caliburn.Micro?
<Style TargetType="{x:Type MenuItem}" x:Key="MenuItemStyle" BasedOn="{StaticResource {x:Type MenuItem}}">
[...]
<Setter Property="int:InteractivityItems.Template">
<Setter.Value>
<int:InteractivityTemplate>
<int:InteractivityItems>
<int:InteractivityItems.Triggers>
<triggers:InputBindingTrigger InputBinding="{Binding Shortcut, Converter={StaticResource StringToKeyBinding}}">
<cal:ActionMessage MethodName="Execute"/>
</triggers:InputBindingTrigger>
</int:InteractivityItems.Triggers>
</int:InteractivityItems>
</int:InteractivityTemplate>
</Setter.Value>
</Setter>
[...]
The problem I am facing is that this trigger is attached to menu item children only when, for example, I open the menu instead of its creation and therefore thr InputBindingTrigger does not work except when opening and then closing the menu.
Is there any way to force the application of ItemContainerStyle when the menu is created instead of openened?