Class Grid
Defines a flexible grid area that consists of columns and rows.
public class Grid : Panel, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, IChildIndexProvider
- Inheritance
-
Grid
- Implements
- Inherited Members
- Extension Methods
Constructors
Grid()
Default constructor.
public Grid()
Fields
ColumnProperty
Column property. This is an attached property. Grid defines Column property, so that it can be set on any element treated as a cell. Column property specifies child's position with respect to columns.
public static readonly AttachedProperty<int> ColumnProperty
Field Value
Remarks
Columns are 0 - based. In order to appear in first column, element
should have Column property set to 0
.
Default value for the property is 0
.
ColumnSpacingProperty
Defines the ColumnSpacing property.
public static readonly StyledProperty<double> ColumnSpacingProperty
Field Value
ColumnSpanProperty
ColumnSpan property. This is an attached property. Grid defines ColumnSpan, so that it can be set on any element treated as a cell. ColumnSpan property specifies child's width with respect to columns. Example, ColumnSpan == 2 means that child will span across two columns.
public static readonly AttachedProperty<int> ColumnSpanProperty
Field Value
Remarks
Default value for the property is 1
.
IsSharedSizeScopeProperty
IsSharedSizeScope property marks scoping element for shared size.
public static readonly AttachedProperty<bool> IsSharedSizeScopeProperty
Field Value
RowProperty
Row property. This is an attached property.
Grid defines Row, so that it can be set
on any element treated as a cell. Row property
specifies child's position with respect to rows.
Rows are 0 - based. In order to appear in first row, element
should have Row property set to Default value for the property is 0
. 0
.
public static readonly AttachedProperty<int> RowProperty
Field Value
RowSpacingProperty
Defines the RowSpacing property.
public static readonly StyledProperty<double> RowSpacingProperty
Field Value
RowSpanProperty
RowSpan property. This is an attached property. Grid defines RowSpan, so that it can be set on any element treated as a cell. RowSpan property specifies child's height with respect to row grid lines. Example, RowSpan == 3 means that child will span across three rows.
public static readonly AttachedProperty<int> RowSpanProperty
Field Value
Remarks
Default value for the property is 1
.
ShowGridLinesProperty
ShowGridLines property. This property is used mostly
for simplification of visual debugging. When it is set
to true
grid lines are drawn to visualize location
of grid lines.
public static readonly StyledProperty<bool> ShowGridLinesProperty
Field Value
Properties
ColumnDefinitions
Returns a ColumnDefinitions of column definitions.
public ColumnDefinitions ColumnDefinitions { get; set; }
Property Value
ColumnSpacing
Gets or sets the size of the spacing to place between grid columns.
public double ColumnSpacing { get; set; }
Property Value
RowDefinitions
Returns a RowDefinitions of row definitions.
public RowDefinitions RowDefinitions { get; set; }
Property Value
RowSpacing
Gets or sets the size of the spacing to place between grid rows.
public double RowSpacing { get; set; }
Property Value
ShowGridLines
ShowGridLines property.
public bool ShowGridLines { get; set; }
Property Value
Methods
ArrangeOverride(Size)
Content arrangement.
protected override Size ArrangeOverride(Size arrangeSize)
Parameters
arrangeSize
SizeArrange size
Returns
ChildrenChanged(object?, NotifyCollectionChangedEventArgs)
protected override void ChildrenChanged(object? sender, NotifyCollectionChangedEventArgs e)
Parameters
sender
objecte
NotifyCollectionChangedEventArgs
GetColumn(Control)
Helper for reading Column property from a Control.
public static int GetColumn(Control element)
Parameters
element
ControlControl to read Column property from.
Returns
- int
Column property value.
GetColumnSpan(Control)
Helper for reading ColumnSpan property from a Control.
public static int GetColumnSpan(Control element)
Parameters
element
ControlControl to read ColumnSpan property from.
Returns
- int
ColumnSpan property value.
GetIsSharedSizeScope(Control)
Helper for reading IsSharedSizeScope property from a Control.
public static bool GetIsSharedSizeScope(Control element)
Parameters
element
ControlControl to read IsSharedSizeScope property from.
Returns
- bool
IsSharedSizeScope property value.
GetRow(Control)
Helper for reading Row property from a Control.
public static int GetRow(Control element)
Parameters
element
ControlControl to read Row property from.
Returns
- int
Row property value.
GetRowSpan(Control)
Helper for reading RowSpan property from a Control.
public static int GetRowSpan(Control element)
Parameters
element
ControlControl to read RowSpan property from.
Returns
- int
RowSpan property value.
MeasureOverride(Size)
Content measurement.
protected override Size MeasureOverride(Size constraint)
Parameters
constraint
SizeConstraint
Returns
- Size
Desired size
SetColumn(Control, int)
Helper for setting Column property on a Control.
public static void SetColumn(Control element, int value)
Parameters
SetColumnSpan(Control, int)
Helper for setting ColumnSpan property on a Control.
public static void SetColumnSpan(Control element, int value)
Parameters
SetIsSharedSizeScope(Control, bool)
Helper for setting IsSharedSizeScope property on a Control.
public static void SetIsSharedSizeScope(Control element, bool value)
Parameters
element
ControlControl to set IsSharedSizeScope property on.
value
boolIsSharedSizeScope property value.
SetRow(Control, int)
Helper for setting Row property on a Control.
public static void SetRow(Control element, int value)
Parameters
SetRowSpan(Control, int)
Helper for setting RowSpan property on a Control.
public static void SetRowSpan(Control element, int value)