namespace Avalonia.Controls
{
///
/// Holds a row definitions for a .
///
public class RowDefinition : DefinitionBase
{
///
/// Defines the property.
///
public static readonly StyledProperty MaxHeightProperty =
AvaloniaProperty.Register(nameof(MaxHeight), double.PositiveInfinity);
///
/// Defines the property.
///
public static readonly StyledProperty MinHeightProperty =
AvaloniaProperty.Register(nameof(MinHeight));
///
/// Defines the property.
///
public static readonly StyledProperty HeightProperty =
AvaloniaProperty.Register(nameof(Height), new GridLength(1, GridUnitType.Star));
///
/// Initializes static members of the class.
///
static RowDefinition()
{
AffectsParentMeasure(MaxHeightProperty, MinHeightProperty);
HeightProperty.Changed.AddClassHandler(OnUserSizePropertyChanged);
}
///
/// Initializes a new instance of the class.
///
public RowDefinition()
{
}
///
/// Initializes a new instance of the class.
///
/// The height of the row.
/// The height unit of the column.
public RowDefinition(double value, GridUnitType type)
{
Height = new GridLength(value, type);
}
///
/// Initializes a new instance of the class.
///
/// The height of the column.
public RowDefinition(GridLength height)
{
Height = height;
}
///
/// Gets the actual calculated height of the row.
///
public double ActualHeight => Parent?.GetFinalRowDefinitionHeight(Index) ?? 0d;
///
/// Gets or sets the maximum height of the row in DIPs.
///
public double MaxHeight
{
get
{
return GetValue(MaxHeightProperty);
}
set
{
SetValue(MaxHeightProperty, value);
}
}
///
/// Gets or sets the minimum height of the row in DIPs.
///
public double MinHeight
{
get
{
return GetValue(MinHeightProperty);
}
set
{
SetValue(MinHeightProperty, value);
}
}
///
/// Gets or sets the height of the row.
///
public GridLength Height
{
get
{
return GetValue(HeightProperty);
}
set
{
SetValue(HeightProperty, value);
}
}
internal override GridLength UserSizeValueCache => this.Height;
internal override double UserMinSizeValueCache => this.MinHeight;
internal override double UserMaxSizeValueCache => this.MaxHeight;
}
}