dotnet / dotnet/wpf

Add Spacing property to StackPanel (similar to Uwp)

Open
#3,591 1 comment 24 reactions 0 assignees View on GitHub
API suggestion Design Discussion
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

The StackPanel in UWP has a property called [Spacing](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.stackpanel.spacing?view=winrt-19041) that:

> Gets or sets a uniform distance (in pixels) between stacked items. It is applied in the direction of the StackPanel's Orientation.

It would be extremely useful to have this in the wpf version of StackPanel as well. Adding such a feature would require a minimal change to both the measure and arrange phase of the panel.

The added benefit would be huge, on a daily basis I have to cludge around with margins on child items to make sure spacing remains correct. Having a uniform spacing would allow me to focus only on those elements in my panels that require custom spacing. It would also make it much more easy to space items dynamically if it were a bindable dependency property.

Similar request for `Grid`: https://github.com/dotnet/wpf/issues/3592

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.