GridColumn.Width Property
Gets or sets the column’s width.
Namespace: DevExpress.XamarinForms.DataGrid
Assembly: DevExpress.XamarinForms.Grid.dll
NuGet Package: DevExpress.XamarinForms.Grid
Declaration
[XtraSerializableProperty]
public GridLength Width { get; set; }
Property Value
Type | Description |
---|---|
GridLength | The column width. |
Remarks
DataGridView adjusts column widths, so that the total width of all columns matches the grid width. When you set the Width property for a column, the grid automatically changes the widths of other columns. To specify the minimum and maximum width that can be assigned to a column, use the MinWidth and MaxWidth properties.
The Width property allows you to define absolute or proportional (star) width value, but does not support the Auto option. When you set the proportional column size, the available space is proportionally distributed among columns similar to the Xamarin.Forms Grid that uses the same “star sizing” mechanism.
<dxg:DataGridView.Columns>
<!-- Absolute width -->
<dxg:TextColumn FieldName="Name" Width="150"/>
<!-- Proportional width -->
<dxg:DateColumn FieldName="Birthday" Width="2*"/>
<dxg:TextColumn FieldName="City" Width="2*"/>
<dxg:NumberColumn FieldName="Visits" Width="*"/>
</dxg:DataGridView.Columns>
If the total width of all columns exceeds the grid width, horizontal scrolling is enabled and users can scroll grid columns. If you want a column (or columns) to be always visible onscreen (regardless of scrolling), set the column’s FixedStyle property. To specify whether the grid should display the horizontal scrollbar, use the IsHorizontalScrollBarVisible property.