I have two separate Silverlight usercontrols containing grids and i want these to share a set of columndefinitions. The columndefinitions must be created dynamically. How can i do this?
A:
You can just add them in code if that is sufficient:
private void CreateColumnDefinitions(Grid grid)
{
grid.ColumnDefinitions.Add(
new ColumnDefinition() { Width = new GridLength(10, GridUnitType.Star) });
grid.ColumnDefinitions.Add(
new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) });
grid.ColumnDefinitions.Add(
new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) });
}
Henrik Söderlund
2010-01-20 11:43:06