dotnet / dotnet/wpf

Add RowSpacing and ColumnSpacing to Grid (similar to Uwp)

Open
#3,592 6 comments 44 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 Grid in UWP has a property called [ColumnSpacing](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.grid.columnspacing?view=winrt-19041#Windows_UI_Xaml_Controls_Grid_ColumnSpacing) and a similar RowSpacing property that:

> Gets or sets the uniform distance (in pixels) between grid columns.

It would be extremely useful to have this in the wpf version of Grid 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, because 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 they were bindable dependency properties.

Similar request for `StackPanel`: https://github.com/dotnet/wpf/issues/3591

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.