Can i right align the menu items in WPF?
Thanks Sharath
Can i right align the menu items in WPF?
Thanks Sharath
<Menu HorizontalAlignment="Stretch" FlowDirection="RightToLeft">
<MenuItem HorizontalAlignment="Right" Header="aaa">
</MenuItem>
<MenuItem HorizontalAlignment="Right" Header="bbb">
</MenuItem>
</Menu>
Yes, you can.
Although the implementation is a little screwy.
If you want to have the menu items in the top menu go from right to left, add FlowDirection="RightToLeft" to your Menu. If you want to have an item aligned right in a dropdown, do the following:
<MenuItem>
<MenuItem.Header>
<TextBlock HorizontalAlignment="Right" >Content</TextBlock>
</MenuItem.Header>
</MenuItem>
If you want to do both, you actually have to set HorizontalAlignment="Left" instead of right, as the FlowDirection reverses the right and left in the Alignments. I don't know why, but that's what you have to do.