Cannot adjust padding on MenuItem elements
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When using WPF-UI, menu items have an approximately 13px padding applied to them. Manually setting the padding on the menu item to a different thickness value is ignored.
To Reproduce
- Create a new project with
WPF-UI - Add a menu bar with menu items
- Change padding on the menu items to
4 - Original padding remains, so if the height of the menu bar is reduced, the menu item text will become cut off.
<Window x:Class="WpfApp2.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"
MinWidth="200"
SizeToContent="WidthAndHeight"
mc:Ignorable="d">
<Menu Height="40" Margin="2">
<MenuItem Padding="4" Header="BUTTON 1" />
<MenuItem Padding="4" Header="BUTTON 2" />
</Menu>
</Window>
Expected behavior
Setting a different padding on the MenuItem element should be respected
Screenshots
Current behavior:
Expected behavior:
OS version
Windows 10
.NET version
All (issue reproduced on .NET Framework 4.8, .NET 6.0 and .NET 8.0)
WPF-UI NuGet version
Both latest stable (2.1.0) and preview (3.0.0-preview.13)
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using the XAML example with WPF-UI MenuItem elements and a custom Padding value. Then trace the MenuItem styling and template used by WPF-UI; the work is done when the specified padding is respected and the menu item text is no longer clipped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100