WPF: Grid with column/row margin/padding?

前端 未结 15 1072
梦毁少年i
梦毁少年i 2020-12-07 23:57

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,

15条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 00:17

    RowDefinition and ColumnDefinition are of type ContentElement, and Margin is strictly a FrameworkElement property. So to your question, "is it easily possible" the answer is a most definite no. And no, I have not seen any layout panels that demonstrate this kind of functionality.

    You can add extra rows or columns as you suggested. But you can also set margins on a Grid element itself, or anything that would go inside a Grid, so that's your best workaround for now.

提交回复
热议问题