In ASP.NET I could make a user control to occupy more than one cell in a table on the page:
UserControl1:
<tr>
<td>foo</td>
<td>bar</td>
</tr>
Page1:
<table>
<put a UserControl1 here/>
<put another UserControl1 here/>
</table>
and the column widths adjusted automatically to fit the largest user control.
Can this be done in WPF too ? How ?
I think that user controls can’t do that, and I must create a simple class instead of a user control, which has a method to add everything to the grid. But that way everything should be done by code, xaml is useless here.
I’ve found the answer here.
It can be done with SharedSizeGroup and Grid.IsSharedSizeScope.
UserControl1.xaml:
Window1.xaml:
Window1.xaml.cs: