blazor-devexpress-dot-blazor-95fd9d9e.md
Lists values that specify whether and how users can resize Grid columns.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public enum GridColumnResizeMode
| Name | Description |
|---|---|
Disabled |
A user cannot resize columns.
|
| NextColumn |
When a user resizes a column, the width of the column to the right changes (considering the MinWidth value), but the Grid’s total width does not change. Users cannot change the width of the rightmost column.
|
| ColumnsContainer |
When a user resizes a column, all other columns retain their widths, but the width of the container that stores all Grid columns changes.
|
The following properties accept/return GridColumnResizeMode values:
| Library | Related API Members |
|---|---|
| Blazor | DxGrid.ColumnResizeMode |
| IGrid.ColumnResizeMode | |
| XAF: Cross-Platform .NET App UI & Web API | DxGridModel.ColumnResizeMode |
Use the ColumnResizeMode property to control whether and how users can resize Grid columns.
@inject NwindDataService NwindDataService
<DxGrid Data="@Data"
ColumnResizeMode="GridColumnResizeMode.NextColumn">
<Columns>
<DxGridDataColumn FieldName="ContactName" MinWidth="100" />
<DxGridDataColumn FieldName="ContactTitle" MinWidth="100" />
<DxGridDataColumn FieldName="CompanyName" MinWidth="100" />
<DxGridDataColumn FieldName="City" Width="10%" MinWidth="80" />
<DxGridDataColumn FieldName="Country" Width="10%" MinWidth="80" />
<DxGridDataColumn FieldName="Phone" Width="15%" MinWidth="80" />
</Columns>
</DxGrid>
@code {
IEnumerable<Supplier> Data { get; set; }
protected override async Task OnInitializedAsync() {
Data = await NwindDataService.GetSuppliersAsync();
}
}
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace BlazorDemo.Data.Northwind {
public partial class Supplier {
public Supplier() {
Products = new HashSet<Product>();
}
public int SupplierId { get; set; }
public string CompanyName { get; set; }
public string ContactName { get; set; }
public string ContactTitle { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string Region { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
public string Phone { get; set; }
public string Fax { get; set; }
public string HomePage { get; set; }
public virtual ICollection<Product> Products { get; set; }
}
}
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using BlazorDemo.Data.Northwind;
using BlazorDemo.DataProviders;
namespace BlazorDemo.Services {
public partial class NwindDataService {
public Task<IEnumerable<Supplier>> GetSuppliersAsync(CancellationToken ct = default) {
// Return your data here
}
}
}
// ...
builder.Services.AddScoped<NwindDataService>();
Grid supports the following column resize modes:
NextColumn
ColumnsContainer
Disabled
Run Demo: Grid - Column Resize
See Also