How can I tell a ContextMenu to place itself relatively to its control and not the cursor? [duplicate] How can I tell a ContextMenu to place itself relatively to its control and not the cursor? [duplicate] wpf wpf

How can I tell a ContextMenu to place itself relatively to its control and not the cursor? [duplicate]


Check out Remarks under ContextMenu.Placement

and try this

<Button Content="Do this" Height="23" Width="75"      ContextMenuService.Placement="Bottom"     Command="local:MyCommands.ThisCommand">    <Button.ContextMenu>        <ContextMenu>            <MenuItem Header="Do this" Command="local:MyCommands.ThisCommand" />            <MenuItem Header="Do that" Command="local:MyCommands.ThatCommand" />        </ContextMenu>    </Button.ContextMenu></Button>