[!Note] Please note that this control has been deprecated and replaced with the Grid component, and as such, we recommend migrating to that control. This will not be receiving any new features, bug fixes will be deprioritized. For help or questions on migrating your codebase to the Data Grid, please contact support.

    Blazor Grid Column Resizing

    La Ignite UI for Blazor Data Grid admite la capacidad de cambiar el tamaño de las columnas, lo que le brinda flexibilidad sobre cómo desea mostrar sus columnas con respecto al ancho de cada una.

    Blazor Grid Column Resizing Example

    Column resizing in the Ignite UI for Blazor DataGrid is on by default, and can be controlled by using the ColumnResizingMode property of the grid. This property has three options. Each option is explained below:

    • Deferred: The default option. When resizing, a separator will appear showing how large or small the column will become when resized.
    • Immediate: When resizing, there will be no separator. The column's width will follow the pointer as you drag the edge of the column and resize accordingly.
    • None: Columns cannot be resized.

    When column resizing is set to Deferred, the separator that shows up can be modified in color and width by using the ColumnResizingSeparatorBackground and ColumnResizingSeparatorWidth properties of the grid, respectively.

    You can also animate the columns as they resize when the resizing mode is set to Deferred only. This is done by setting the ColumnResizingAnimationMode property to Interpolate.

    Se puede determinar si cada columna de la cuadrícula puede cambiar de tamaño individualmente o no. Si desea habilitar o deshabilitar el cambio de tamaño en una columna en particular, puede configurar la propiedad IsResizingEnabled de esa columna.

    Al cambiar el tamaño de una columna de ancho de estrella, cambiará esa columna a una columna fija.

    Code Snippet

    El siguiente fragmento de código demuestra cómo implementar el cambio de tamaño de columnas en la cuadrícula de datos Blazor, donde la columna Street en este caso no se podrá cambiar de tamaño. En este caso, el separador de cambio de tamaño de columnas tendrá 5 píxeles de ancho y las columnas que se puedan cambiar de tamaño también se animarán cuando se cambie su tamaño:

    <IgbDataGrid Height="100%" Width="100%"
        AutoGenerateColumns="false"
        DataSource="DataSource"
        ColumnResizingMode="ColumnResizingMode.Deferred"
        ColumnResizingAnimationMode="ColumnResizingAnimationMode.Interpolate"
        ColumnResizingSeparatorWidth="5">
        <IgbTextColumn Field="FirstName" />
        <IgbTextColumn Field="LastName" />
        <IgbTextColumn Field="Street" IsResizingEnabled="false" />
        <IgbTextColumn Field="City" />
    </IgbDataGrid>
    

    API References