tags:

views:

707

answers:

1

Hi,

Can i right align the menu items in WPF?

Thanks Sharath

+1  A: 

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.

Drew McGhie
Isn't it wonderful when you find out that one solution screws up another? Seriously, try making a menu with the FlowDirection="RtL" and aligning things right, they all go left!
Drew McGhie