Class UniformGrid
Represents a layout panel that arranges child elements in a uniform grid where all cells have equal size.
Inherited Members
Namespace: Telerik.WinControls.Layouts
Assembly: Telerik.WinControls.dll
Syntax
public class UniformGrid : LayoutPanel, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode
Remarks
UniformGrid extends LayoutPanel to provide grid-based layout capabilities where all grid cells are uniformly sized. Unlike regular grids where rows and columns can have different sizes, all cells in a UniformGrid have identical dimensions, calculated by dividing the available space evenly among the specified number of rows and columns.
The grid can be configured with a specific number of rows and columns, or these values can be automatically calculated based on the number of child elements. Child elements can be positioned at specific grid coordinates using attached properties.
UniformGrid is commonly used for displaying items that should have consistent size, such as icon grids, tile layouts, button panels, and other scenarios where visual uniformity is important.
Constructors
UniformGrid()
Declaration
public UniformGrid()
Fields
ColumnsProperty
Identifies the Columns dependency property.
Declaration
public static readonly RadProperty ColumnsProperty
Field Value
RadProperty
|
Remarks
This property determines the number of columns in the uniform grid. When set to 0, the number of columns is automatically calculated based on the number of child elements.
FirstColumnProperty
Identifies the FirstColumn dependency property.
Declaration
public static readonly RadProperty FirstColumnProperty
Field Value
RadProperty
|
Remarks
This property specifies the first column where child elements should start being placed. This allows for offsetting the grid placement and creating layouts with leading empty cells.
RowsProperty
Identifies the Rows dependency property.
Declaration
public static readonly RadProperty RowsProperty
Field Value
RadProperty
|
Remarks
This property determines the number of rows in the uniform grid. When set to 0, the number of rows is automatically calculated based on the number of child elements.
UniformGridColumnIndexProperty
Identifies the column index attached property for child elements.
Declaration
public static readonly RadProperty UniformGridColumnIndexProperty
Field Value
RadProperty
|
Remarks
This attached property allows explicit positioning of child elements at specific column indices within the uniform grid, overriding the default sequential placement.
UniformGridRowIndexProperty
Identifies the row index attached property for child elements.
Declaration
public static readonly RadProperty UniformGridRowIndexProperty
Field Value
RadProperty
|
Remarks
This attached property allows explicit positioning of child elements at specific row indices within the uniform grid, overriding the default sequential placement.
Properties
Columns
Gets or sets the number of columns in the uniform grid.
Declaration
public int Columns { get; set; }
Property Value
System.Int32
An integer value representing the number of columns. When set to 0 (default), the number of columns is automatically calculated based on the number of child elements. |
Remarks
Setting this property to a specific value forces the grid to use exactly that many columns, regardless of the number of child elements. Child elements will wrap to new rows as needed.
FirstColumn
Gets or sets the index of the first column where child elements begin placement.
Declaration
public int FirstColumn { get; set; }
Property Value
System.Int32
An integer value representing the starting column index. The default value is 0. |
Remarks
This property allows you to offset the placement of child elements, creating empty cells at the beginning of the grid. Child elements will start filling cells from this column index.
Rows
Gets or sets the number of rows in the uniform grid.
Declaration
public int Rows { get; set; }
Property Value
System.Int32
An integer value representing the number of rows. When set to 0 (default), the number of rows is automatically calculated based on the number of child elements. |
Remarks
Setting this property to a specific value forces the grid to use exactly that many rows, regardless of the number of child elements. Child elements will wrap to new columns as needed.
Methods
ArrangeOverride(SizeF)
Declaration
protected override SizeF ArrangeOverride(SizeF finalSize)
Parameters
System.Drawing.SizeF
finalSize
|
Returns
System.Drawing.SizeF
|
Overrides
GetColumnIndex(RadElement)
Gets the column index for the specified element within the uniform grid.
Declaration
public static int GetColumnIndex(RadElement element)
Parameters
RadElement
element
The element whose column position will be retrieved. |
Returns
System.Int32
An integer representing the zero-based column index of the element. |
Remarks
This method retrieves the attached property value that specifies the element's column position within the uniform grid layout.
GetRowIndex(RadElement)
Gets the row index for the specified element within the uniform grid.
Declaration
public static int GetRowIndex(RadElement element)
Parameters
RadElement
element
The element whose row position will be retrieved. |
Returns
System.Int32
An integer representing the zero-based row index of the element. |
Remarks
This method retrieves the attached property value that specifies the element's row position within the uniform grid layout.
MeasureOverride(SizeF)
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
System.Drawing.SizeF
availableSize
|
Returns
System.Drawing.SizeF
|
Overrides
SetColumnIndex(RadElement, Int32)
Sets the column index for the specified element within the uniform grid.
Declaration
public static void SetColumnIndex(RadElement element, int index)
Parameters
RadElement
element
The element whose column position will be set. |
System.Int32
index
The zero-based column index where the element should be placed. |
Remarks
This method sets an attached property that allows explicit positioning of elements at specific grid coordinates, overriding the default sequential placement behavior.
SetRowIndex(RadElement, Int32)
Sets the row index for the specified element within the uniform grid.
Declaration
public static void SetRowIndex(RadElement element, int index)
Parameters
RadElement
element
The element whose row position will be set. |
System.Int32
index
The zero-based row index where the element should be placed. |
Remarks
This method sets an attached property that allows explicit positioning of elements at specific grid coordinates, overriding the default sequential placement behavior.