Click here to Skip to main content
15,881,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
How to hide contextMenu border ?
It seems it's part of default style.

Thank you,

A screenshot is here
https://ibb.co/btNCUp

What I have tried:

<ToggleButton Name="MyButton">
 <StackPanel Orientation="Vertical">
  <Image Source="{Binding IconPath , Converter={StaticResource EmptyImageConverter}}" Height="60"/>
  <TextBlock TextAlignment="Center" Text="{Binding Name}"/>
 </StackPanel>

 <ToggleButton.ContextMenu>
 <ContextMenu ContextMenuService.Placement="Top" ItemsSource="{Binding SubViews}" BorderThickness="0">

  <ContextMenu.ItemContainerStyle>
   <Style TargetType="{x:Type MenuItem}">
   <Setter Property="Background" Value="{StaticResource TransparentSliderSolidColorBrush}"/>                                                 
   <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type MenuItem}">
     <Border x:Name="Bd" Background="#181818" SnapsToDevicePixels="True">
      <Grid>
       <Grid.ColumnDefinitions>                                                                                      <ColumnDefinition Width="*"/>                                                                      <ColumnDefinition Width="Auto"/>
                                                                            </Grid.ColumnDefinitions>
<Image Source="{Binding IconPath , Converter={StaticResource EmptyImageConverter}}" Margin="0,0,0,10"/>
                                                                        <TextBlock Grid.Column="1" FontSize="12" Foreground="White" Text="{Binding Name , Mode=OneWay}"  HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,7"/>
 </Grid>
                                                                   
 </Border>
                                                                <ControlTemplate.Triggers>
 <Trigger Property="IsHighlighted" Value="True">
 <Setter TargetName="Bd" Property="Background" Value="{StaticResource ControlBlack500SolidColorBrush}" />
 </Trigger>
                                                                </ControlTemplate.Triggers>
 </ControlTemplate>
 </Setter.Value>
 </Setter>
 </Style>
 </ContextMenu.ItemContainerStyle>
 </ContextMenu>
 </ToggleButton.ContextMenu>
                                    
 </ToggleButton>
Posted
Updated 11-Sep-18 4:47am

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900