context menu
-
Hello, I have a button and a context menu on it. I want to align the context menu to be opened on top of the button. I mean on the Upper Left corner of the button. How can i do it in XAML? currently i use the code:
Button Grid.Column="1" BorderThickness="0" Name="dropDownbtn" Click="dropDownbtn_Click" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<Button.ContextMenu> </Button.ContextMenu> </Button>
-
Hello, I have a button and a context menu on it. I want to align the context menu to be opened on top of the button. I mean on the Upper Left corner of the button. How can i do it in XAML? currently i use the code:
Button Grid.Column="1" BorderThickness="0" Name="dropDownbtn" Click="dropDownbtn_Click" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<Button.ContextMenu> </Button.ContextMenu> </Button>
The easiest way to do this is to use the ContextMenuService on the button itself. So, in your button definition, add
ContextMenuService.Placement="Top"
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
The easiest way to do this is to use the ContextMenuService on the button itself. So, in your button definition, add
ContextMenuService.Placement="Top"
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
OK. Another issue is that this context menu opened on left mouse click on button. But it never enters the can_execute . But when i click Right Mouse Button it does enters can_execute. How to solve it?