// -----------------------------------------------------------------------
//
// Copyright 2015 MIT Licence. See licence.md for more information.
//
// -----------------------------------------------------------------------
namespace Perspex.Controls
{
///
/// Holds a column definitions for a .
///
public class ColumnDefinition : DefinitionBase
{
///
/// Defines the property.
///
public static readonly PerspexProperty MaxWidthProperty =
PerspexProperty.Register("MaxWidth", double.PositiveInfinity);
///
/// Defines the property.
///
public static readonly PerspexProperty MinWidthProperty =
PerspexProperty.Register("MinWidth");
///
/// Defines the property.
///
public static readonly PerspexProperty WidthProperty =
PerspexProperty.Register("Width", new GridLength(1, GridUnitType.Star));
///
/// Initializes a new instance of the class.
///
public ColumnDefinition()
{
}
///
/// Initializes a new instance of the class.
///
/// The width of the column.
/// The width unit of the column.
public ColumnDefinition(double value, GridUnitType type)
{
this.Width = new GridLength(value, type);
}
///
/// Initializes a new instance of the class.
///
/// The width of the column.
public ColumnDefinition(GridLength width)
{
this.Width = width;
}
///
/// Gets the actual calculated width of the column.
///
public double ActualWidth
{
get;
internal set;
}
///
/// Gets or sets the maximum width of the column in DIPs.
///
public double MaxWidth
{
get { return this.GetValue(MaxWidthProperty); }
set { this.SetValue(MaxWidthProperty, value); }
}
///
/// Gets or sets the minimum width of the column in DIPs.
///
public double MinWidth
{
get { return this.GetValue(MinWidthProperty); }
set { this.SetValue(MinWidthProperty, value); }
}
///
/// Gets or sets the width of the column.
///
public GridLength Width
{
get { return this.GetValue(WidthProperty); }
set { this.SetValue(WidthProperty, value); }
}
}
}