lepoco / lepoco/wpfui

Cannot adjust padding on MenuItem elements

Open
#916 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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
  1. Create a new project with WPF-UI
  2. Add a menu bar with menu items
  3. Change padding on the menu items to 4
  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:
image

Expected behavior:
image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.