使用官方的代码:
<TemplateColumn Hidden="@(_isCellEditMode || _readOnly || _editTriggerRowClick)" CellClass="d-flex justify-end">
<CellTemplate>
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Edit" OnClick="@context.Actions.StartEditingItemAsync" />
</CellTemplate>
</TemplateColumn>
点击按钮不起作用,需要修改MudDataGrid
属性:
<MudDataGrid Items="@_elements" Filterable="true" FilterMode="DataGridFilterMode.Simple" Loading="@_loading" ReadOnly="false"
EditMode="DataGridEditMode.Form" EditTrigger="DataGridEditTrigger.Manual">
添加:
ReadOnly="false"