sony
sony

Reputation: 1503

WPF Menuitems align left?

enter image description here

I want to display the menuitems to the right side of the Main menu. Currently its displayed to the left.

  <Menu Name="menu1" Width="800" Margin="0,0,0,670">
        <MenuItem Header="File">
            <MenuItem Header="Open"/>
            <MenuItem Header="Close"/>
        </MenuItem>
        <MenuItem Header="Edit"/>
    </Menu>


 <Style TargetType="{x:Type MenuItem}">
        <Setter Property="MinHeight" Value="30" />
        <Setter Property="MinWidth" Value="100"/>
        <Setter Property="HeaderTemplate">
            <Setter.Value>
                <DataTemplate>
                    <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"  Content="{Binding}" />                       
                </DataTemplate>                    
            </Setter.Value>               
        </Setter>
        <Setter Property="Background" Value="Yellow" />
        <Setter Property="BorderBrush" Value="Black" />
        <Setter Property="BorderThickness" Value="1" />
    </Style>

Upvotes: 2

Views: 3576

Answers (1)

Lukas Elmer
Lukas Elmer

Reputation: 333

It seems to be a configuration problem with your local windows machine (check if this behavior appears in other programs too). If yes, you have two possibilities to fix this:

Choice 1

  • Win+R
  • Enter "shell:::{80F3F1D5-FECA-45F3-BC32-752C152E456E}", press Ok
  • Under "Other" change Right-Handed to Left-Handed, press Ok

Your menus should open left-aligned.

Choice 2

  • Open your registry and change the following entry: [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\MenuDropAlignment] to "0"
  • Reboot

Upvotes: 14

Related Questions