Search code examples
xamlcontextmenublendsketchflow

Context Menus and NavigateTo in Blend / SketchFlow


Hoping this will be a simple one, in Sketchflow i'm trying to wire up a context menu to navigate to another page.

I've created the context menu, added a menu item, right clicked the mneu item in the Objects and Timeline panel and selected navigateto. When i run it, the menu comes up but when i click on the menu item it doesn't do anything.

I previously had the NavigateTo working when left clicking on another object, so the screens / connections are all in place.

This is the xaml that was generated:

    <ContextMenu>
 <MenuItem Header="Edit">
  <i:Interaction.Triggers>
   <i:EventTrigger EventName="MouseDown">
    <pb:NavigateToScreenAction TargetScreen="SomeScreen.Screen_3_2"/>
   </i:EventTrigger>
  </i:Interaction.Triggers>
 </MenuItem>
</ContextMenu>

Solution

  • This xaml works for the scenario I think you are trying to achieve:

    <Button Content="Button">
                <Button.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="Next">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <pb:NavigateToScreenAction TargetScreen="WpfPrototype3Screens.Screen_2"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </MenuItem>
                    </ContextMenu>
                </Button.ContextMenu>
            </Button>