简体   繁体   中英

How to set a minimum width for MudBlazor MudDataGrid columns?

I need to set a minimum width for the some of the columns in my MudBlazor MudDataGrid .

I could not find an option in the MudDataGrid column component and even when I set a minimum width in the CSS style property of the column component there was no change to the width.

How do I go about setting a minimum width for the MudDataGrid columns that need it?

<MudDataGrid T="Car" Items="@Cars" Sortable="true" Filterable="false" Outlined="true">
    <Columns>
        <Column T="Car" Field="Description" Sortable="false" Title="Description" Style="min-width: 1000px"/> 
    </Columns>
    <PagerContent>
        <MudDataGridPager T="Car" />
    </PagerContent>
</MudDataGrid>

You have to set the CellStyle parameter of the Column .

<Column CellStyle="min-width: 1000px;" T="Car" Field="Description" Sortable="false" Title="Description" /> 

https://try.mudblazor.com/snippet/QEmxOlYHCztUtxRO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM