/// <summary> /// Called when the columns property is changed. /// </summary> /// <param name="dependencyObject">The dependency object.</param> /// <param name="args">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private static void OnColumnsChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args) { // Get the apex grid. ApexGrid apexGrid = dependencyObject as ApexGrid; // Clear any current column definitions. apexGrid.ColumnDefinitions.Clear(); // Add each column from the column lengths definition. foreach (var columnLength in StringLengthsToGridLengths(apexGrid.Columns)) { apexGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = columnLength }); } }
/// <summary> /// Called when the rows property is changed. /// </summary> /// <param name="dependencyObject">The dependency object.</param> /// <param name="args">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private static void OnRowsChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args) { // Get the apex grid. ApexGrid apexGrid = dependencyObject as ApexGrid; // Clear any current rows definitions. apexGrid.RowDefinitions.Clear(); // Add each row from the row lengths definition. foreach (var rowLength in StringLengthsToGridLengths(apexGrid.Rows)) { apexGrid.RowDefinitions.Add(new RowDefinition() { Height = rowLength }); } }