public ColumnHeader (string text, GridLength width ) : base ( width ) { if (width.IsAuto) throw new NotImplementedException ("Auto"); this.TextAlignment = TextAlignment.Left; this.Text = text; this.TextColor = Color.White; }
/// <summary> /// Set the height/width of the given row/column /// </summary> private static void SetDefinitionLength(DefinitionAbstraction definition, GridLength length) { if (definition.AsColumnDefinition != null) { definition.AsColumnDefinition.SetValue(ColumnDefinition.WidthProperty, length); } else { definition.AsRowDefinition.SetValue(RowDefinition.HeightProperty, length); } }
// optimized measure for common usage private Size MeasureSingleCell(Size availableSize, GridLength width, GridLength height) { Size desiredSize = Size.Zero; availableSize = new Size(width.IsAbsolute ? width.Value : availableSize.Width, height.IsAbsolute ? height.Value : availableSize.Height); foreach (FrameworkElement child in Children) { child.Measure(availableSize); desiredSize = desiredSize.Max(child.DesiredSize); } return desiredSize; }
// optimized arrange for common usage private Size ArrangeSingleCell(Size finalSize, GridLength width, GridLength height) { double finalWidth = width.IsAbsolute ? width.Value : finalSize.Width; double finalHeight = height.IsAbsolute ? height.Value : finalSize.Height; Rect finalRect = new Rect(finalWidth, finalHeight); foreach (FrameworkElement child in Children) { child.Arrange(finalRect); } return finalSize; }
public ColumnDefinition (GridLength width) : this ( width, null, null ) { }
public ColumnDefinition (GridLength width, float? minWidth, float? maxWidth) { this.Width = width; this.MinWidth = minWidth; this.MaxWidth = maxWidth; }