user3678081
user3678081

Reputation: 65

WPF submenuitem position

I have the following menu, I don't want the submenu items to exceed the application window, I want them to show on the right of the menuitem pressed, not to the left. Any suggestions?

<Menu DockPanel.Dock="Top" x:Name="MainMenu" Height="25">
    <Menu.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0"/>
            <GradientStop Color="#FF4C5568" Offset="1"/>
        </LinearGradientBrush>
    </Menu.Background>
    <MenuItem Header="Medio" Foreground="White"  HorizontalContentAlignment="Right" HorizontalAlignment="Right">
        <MenuItem Header="Abrir archivo" VerticalAlignment="Top" HorizontalContentAlignment="Right" HorizontalAlignment="Left" x:Name="OpenVideoFile" Foreground="Black"/>
        <MenuItem Header="Abrir disco" VerticalAlignment="Top" HorizontalContentAlignment="Right" HorizontalAlignment="Left" x:Name="OpenVideoDisc" Foreground="Black"/>
    </MenuItem>
    <MenuItem Header="Reproducci?n" SubmenuOpened="MenuItem_SubmenuOpened" IsEnabled="{Binding IsReady}" Foreground="White" HorizontalAlignment="Right">
        <MenuItem Header="T?tulo" Foreground="Black" x:Name="TitleList" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding TitleList}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
        <MenuItem Header="Cap?tulo" Foreground="Black" x:Name="ChapterList" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding ChapterList}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
        <MenuItem Header="Subt?tulo" Foreground="Black" x:Name="SubtitleList" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding SubtitlesList}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
        <MenuItem Header="Pista V?deo" Foreground="Black" x:Name="VideoTrack" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding VideoTracks}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
        <MenuItem Header="Pista Audio" Foreground="Black" x:Name="AudioTrack" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding AudioTracks}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
    </MenuItem>
    <MenuItem Style="{StaticResource MenuitemStyle}" Width="452" Height="27"     >
        <MenuItem.Header>
            <Grid Visibility="Visible" MouseLeftButtonDown="WindowMouseLeftButtonDown" Background="Transparent"/>
        </MenuItem.Header>
    </MenuItem>
    <MenuItem Width="50" Height="22" Style="{StaticResource MenuitemStyle}" RenderTransformOrigin="1.17,0.409">
        <MenuItem.Header>
            <Button Width="50" BorderThickness="0" x:Name="Close" HorizontalAlignment="Right" VerticalAlignment="Bottom" Style="{StaticResource CloseStyle}" Height="22" Click="Close_Click" Margin="0,0,-26,0"/>
        </MenuItem.Header>
    </MenuItem>
</Menu>

here you can see the image:

enter image description here

Upvotes: 0

Views: 1494

Answers (1)

okravets
okravets

Reputation: 26

I figure out what is causing this issue. It is happening due to new feature from Microsoft in Windows 8.1. There are settings in Control panel -> Tablet PC settings. Depends if you right or left handed, you could control where menu will be shown.

Upvotes: 1

Related Questions