© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•17mo ago•
6 replies
Vir Godem

WPF Submenu Styling

I can't seem to figure how to get rid of the border in submenus in WPF. More specifically, can't figure out how to get rid of that border.

For minimum repo, create a new WPF application and have this as your MainWindow's xml file::

<Window x:Class="SubmenustyleTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:SubmenustyleTest"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <StackPanel>
        <Menu>
            <MenuItem Header="File">
                <MenuItem.ItemContainerStyle>
                    <Style>
                        <Setter Property="ItemsControl.Background" Value="LightCoral"/>
                        <Setter Property="ItemsControl.BorderBrush" Value="OrangeRed"/>
                        <Setter Property="ItemsControl.Margin" Value="0"/>
                    </Style>
                </MenuItem.ItemContainerStyle>
                
                <MenuItem Header="Open"/>
                <MenuItem Header="Save"/>
            </MenuItem>
        </Menu>
    </StackPanel>
</Window>
<Window x:Class="SubmenustyleTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:SubmenustyleTest"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <StackPanel>
        <Menu>
            <MenuItem Header="File">
                <MenuItem.ItemContainerStyle>
                    <Style>
                        <Setter Property="ItemsControl.Background" Value="LightCoral"/>
                        <Setter Property="ItemsControl.BorderBrush" Value="OrangeRed"/>
                        <Setter Property="ItemsControl.Margin" Value="0"/>
                    </Style>
                </MenuItem.ItemContainerStyle>
                
                <MenuItem Header="Open"/>
                <MenuItem Header="Save"/>
            </MenuItem>
        </Menu>
    </StackPanel>
</Window>
Screenshot_134.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Wpf RichTextBox styling
C#CC# / help
3y ago
WPF Styling of a button
C#CC# / help
2y ago
❔ wpf styling/templating with custom dependency properties?
C#CC# / help
3y ago