private static void AssociateRowDefinitions(Grid target, SizeDefinitionCollection collection) { target.RowDefinitions.Clear(); IEnumerable <RowDefinition> copiedDefinitions = collection.Select(d => new RowDefinition { SharedSizeGroup = d.SharedSizeGroup, Height = d.Size }); foreach (var copiedDefinition in copiedDefinitions) { target.RowDefinitions.Add(copiedDefinition); } }
/// <summary> /// Sets the row size definitions for the provided <see cref="Grid"/> instance. /// </summary> /// <param name="source">The <see cref="Grid"/> to set the row definitions for.</param> /// <param name="collection">The collection of row size definitions to set.</param> public static void SetRowDefinitions(Grid source, SizeDefinitionCollection collection) { Require.NotNull(source, nameof(source)); source.SetValue(RowDefinitionsProperty, collection); }