wpfgridpaddingmargin

WPF: Grid with column/row margin/padding?


Is it easily possible to specify a margin and/or padding for rows or columns in a WPF Grid?

I could of course add extra columns to space things out, but this seems like a job for padding/margins (it will give much simplier XAML). Has someone derived from the standard Grid to add this functionality?


Solution

  • You could write your own GridWithMargin class, inherited from Grid, and override the ArrangeOverride method to apply the margins