Describe the bug
If you set the Margin property on a HeaderedItemsControl, the actual margin applied is double the value set.
I suspect this is caused by
|
<ItemsPresenter Margin="{TemplateBinding Margin}" |
because if I create a copy of the style with the margin removed, then the margin is only applied once.
This issue doesn't apply to the Padding property though, even though that is set in the template similarly. Padding is not doubled, and removing the padding from the style causes no padding to be applied. I'm not familiar enough with how this works to know why margin and padding are handled differently here, so I don't know if the fix is to simply remove the margin from the style, or if that would cause other issues.
Steps to reproduce
1. Create a WinUI 3 project with a `HeaderedItemsControl` containing some items. Measure the space around the items.
2. Add `Margin="10"` to the control. Measure the space around the items and observe that it is 20 larger than before instead of 10.
Expected behavior
The amount of margin applied should be the exact value given.
Screenshots
No response
Code Platform
Windows Build Number
Other Windows Build number
No response
App minimum and target SDK version
Other SDK version
No response
Visual Studio Version
2026
Visual Studio Build Number
18.4.3
Device form factor
No response
Additional context
No response
Help us help you
Yes, but only if others can assist.
Describe the bug
If you set the
Marginproperty on aHeaderedItemsControl, the actual margin applied is double the value set.I suspect this is caused by
Windows/components/HeaderedControls/src/HeaderedItemsControl/HeaderedItemsControl.xaml
Line 14 in b1d8231
This issue doesn't apply to the
Paddingproperty though, even though that is set in the template similarly. Padding is not doubled, and removing the padding from the style causes no padding to be applied. I'm not familiar enough with how this works to know why margin and padding are handled differently here, so I don't know if the fix is to simply remove the margin from the style, or if that would cause other issues.Steps to reproduce
Expected behavior
The amount of margin applied should be the exact value given.
Screenshots
No response
Code Platform
Windows Build Number
Other Windows Build number
No response
App minimum and target SDK version
Other SDK version
No response
Visual Studio Version
2026
Visual Studio Build Number
18.4.3
Device form factor
No response
Additional context
No response
Help us help you
Yes, but only if others can assist.