internal object CreateDomElement_CSSVersion(object parentRef, out object domElementWhereToPlaceChildren) { #if !BRIDGE object outerDiv = base.CreateDomElement(parentRef, out _innerDiv); #else object outerDiv = CreateDomElement_WorkaroundBridgeInheritanceBug(parentRef, out _innerDiv); #endif domElementWhereToPlaceChildren = _innerDiv; // Set the element on which the "MaxWidth" and "MaxHeight" properties should be applied (cf. zendesk ticket #1178 where scrollbars inside the ChildWindow did not function properly): this.INTERNAL_OptionalSpecifyDomElementConcernedByMinMaxHeightAndWidth = _innerDiv; // Set the "display" CSS property: dynamic style = INTERNAL_HtmlDomManager.GetDomElementStyleForModification(_innerDiv); style.display = !Grid_InternalHelpers.isMSGrid() ? style.display = "grid" : Grid_InternalHelpers.INTERNAL_CSSGRID_MS_PREFIX + "grid"; // Normalize the sizes of the rows and columns: List <ColumnDefinition> normalizedColumnDefinitions = null; List <RowDefinition> normalizedRowDefinitions = null; Grid_InternalHelpers.NormalizeWidthAndHeightPercentages(this, _columnDefinitionsOrNull, _rowDefinitionsOrNull, out normalizedColumnDefinitions, out normalizedRowDefinitions); // Refresh the rows heights and columns widths: Grid_InternalHelpers.RefreshAllRowsHeight_CSSVersion(this, normalizedColumnDefinitions, normalizedRowDefinitions); Grid_InternalHelpers.RefreshAllColumnsWidth_CSSVersion(this, normalizedColumnDefinitions, normalizedRowDefinitions); return(outerDiv); }
private void RowDefinitions_CollectionChanged_CSSVersion(object sender, NotifyCollectionChangedEventArgs e) { if (this._isLoaded) { Grid_InternalHelpers.RefreshAllRowsHeight_CSSVersion(this); LocallyManageChildrenChanged(); } }
void RowDefinitions_CollectionChanged_CSSVersion(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { foreach (RowDefinition rowDefinition in e.NewItems) { rowDefinition.Parent = this; } } if (this._isLoaded) { Grid_InternalHelpers.RefreshAllRowsHeight_CSSVersion(this); LocallyManageChildrenChanged(); } }
private static void Height_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e) { var rowDefinition = (RowDefinition)d; Grid grid = rowDefinition.Parent; if (grid != null && INTERNAL_VisualTreeManager.IsElementInVisualTree(grid)) { if (Grid_InternalHelpers.isCSSGridSupported()) { //------------- // CSS Grid //------------- // We refresh all the rows: Grid_InternalHelpers.RefreshAllRowsHeight_CSSVersion(grid); } else { //------------- // Non-CSS Grid //------------- bool isStar = (e.OldValue != null && ((GridLength)e.OldValue).IsStar) || (e.NewValue != null && ((GridLength)e.NewValue).IsStar); if (isStar) { // If we are dealing with a "Star" row, we need to refresh all the rows (because of the need to recalculate percentages normalization etc.): Grid_InternalHelpers.RefreshAllRowsHeight_NonCSSVersion(grid); } else { // Only refresh the current row: if (grid._columnDefinitionsOrNull != null) { int rowIndex = grid._rowDefinitionsOrNull.IndexOf(rowDefinition); bool isTheOnlyRow = grid._columnDefinitionsOrNull == null || grid._columnDefinitionsOrNull.Count < 2; Grid_InternalHelpers.RefreshRowHeight_NonCSSVersion(grid, rowIndex, isTheOnlyRow); // Note: we do not need to pass the normalized row definition because this method will only be called when we change the row's height without any star measurement involved (nor star before nor after). } } } } rowDefinition.Parent?.InvalidateMeasure(); }