1

I am using DropDownButton control of Mahapps.Metro components pack. I want to highlight the whole line in ContextMenu (this is a part of this control).

XAML

 <controls:DropDownButton x:Name="ddbPlaylist" Grid.Column="1" BorderThickness="0" ArrowBrush="{x:Null}" ItemsSource="{Binding PlaylistVM}"
                                    HorizontalContentAlignment="Stretch" VerticalContentAlignment="Bottom" Grid.Row="0">
        <controls:DropDownButton.ItemContainerStyle>
            <Style TargetType="{x:Type MenuItem}">
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            </Style>
        </controls:DropDownButton.ItemContainerStyle>
        <controls:DropDownButton.Content>
            <TextBlock Text="{Binding Title}" TextTrimming="CharacterEllipsis" Style="{StaticResource DetailsTextStyle}" VerticalAlignment="Bottom"/>
        </controls:DropDownButton.Content>
    </controls:DropDownButton>

As the MenuItems contains left and the right margin, reserved in order to show icon and glyph. I have found a solution for ContextMenu System.Windows.Controls.MenuItem without icon area but can not understand how to apply it in my case. Becouse ContextMenu lies in very depths of DropDownButton template, i ca not find a way to change it's style.

Community
  • 1
  • 1
Anton
  • 339
  • 2
  • 15

0 Answers0