Dmitry Dyachkov
Dmitry Dyachkov

Reputation: 1785

WPF Grid transparently sharing it's layout to children

Group box inside the grid is a common layout scheme in WPF applications. Once I had to position several groupboxes inside grid one per each row. Despite of different groupboxes, elements that are inside of those groupboxes must be positioned uniformly according to the grid columns so that the design would be reqular and rhythmic. But this is not possible, because only group boxes inside the grid know about the grid attached properties.

Nevertheless, I wonder is there a way to make grid properties transparent to all the children without redundant child grids.

Upvotes: 0

Views: 47

Answers (2)

Rob van Daal
Rob van Daal

Reputation: 367

Btw, if you do mean regular Grids, then you should check the SharedSizeGroup property:

https://msdn.microsoft.com/en-us/library/system.windows.controls.definitionbase.sharedsizegroup%28v=vs.110%29.aspx

Upvotes: 2

Rob van Daal
Rob van Daal

Reputation: 367

Depending if you are referring to a Grid or a DataGrid (i suspect the last one), i think you need a DataGrid bound to a CollectionViewSource with GroupDescriptions. The group items are then the GroupBoxes.

Upvotes: 0

Related Questions