You can set a shared size group to make the width of the two columns in different grids consistent. To set a shared dimension group, follow these steps:
- Put two grids in a parent container, such as grid and Set grid. issharedsiz.pdf = "true"
- Add sharedsizegroup = "textlabel" to columns with the same width"
Example:
<GridGrid. issharedsiz.pdf = "true">
<Grid. rowdefinitions>
<Rowdefinition/>
<Rowdefinition/>
</Grid. rowdefinitions>
<Grid margin = "3" background = "lightyellow" showgridlines = "true">
<Grid. columndefinitions>
<Columndefinition width = "Auto"Sharedsizegroup = "textlabel"/>
<Columndefinition width = "Auto"/>
<Columndefinition/>
</Grid. columndefinitions>
<Label margin = "5"> This is a shared size group column !!!! </Label>
<Label grid. Column = "1" margin = "5"> more text </label>
<Textbox grid. Column = "2" margin = "5"> a text box </textbox>
</GRID>
<Grid. Row = "1" margin = "3" background = "lightyellow" showgridlines = "true">
<Grid. columndefinitions>
<Columndefinition width = "Auto"Sharedsizegroup = "textlabel">
</Columndefinition>
<Columndefinition>
</Columndefinition>
</Grid. columndefinitions>
<Label margin = "5"> shared size group column </label>
<Textbox grid. Column = '1' margin = "5"> a text box </textbox>
</GRID>
</GRID>
Share size groups between WPF Grids