docs/en/release-info/migration-guides/blazorise-2-0-migration.md
//[doc-seo]
{
"Description": "This migration guide provides a comprehensive overview of the necessary code changes when upgrading your ABP solution from Blazorise 1.x to 2.0, ensuring a smooth transition to the latest version."
}
This document summarizes the required code changes when upgrading ABP solutions from Blazorise 1.x to 2.0.
Upgrade Blazorise-related packages to 2.0.0.
BlazoriseBlazorise.ComponentsBlazorise.DataGridBlazorise.SnackbarBlazorise.Bootstrap5Blazorise.Icons.FontAwesomeBlazorise 2.0 uses new input component names:
TextEdit -> TextInputMemoEdit -> MemoInputDateEdit -> DateInputTimeEdit -> TimeInputNumericEdit -> NumericInputColorEdit -> ColorInputFileEdit -> FileInputMigrate old binding/value APIs to the new Value model.
@bind-Text -> @bind-ValueText / TextChanged -> Value / ValueChanged@bind-Checked -> @bind-ValueChecked / CheckedChanged -> Value / ValueChangedCheckedValue / CheckedValueChanged -> Value / ValueChanged@bind-Date / @bind-Time -> @bind-ValueDate / DateChanged -> Value / ValueChangedTime / TimeChanged -> Value / ValueChanged@bind-SelectedValue (for Select) -> @bind-ValueSelectedValue / SelectedValueChanged (for Select) -> Value / ValueChanged@bind-Checked (for Switch) -> @bind-ValueChecked / CheckedChanged (for Switch) -> Value / ValueChangedFor SelectionMode="DateInputSelectionMode.Range", the old Dates / DatesChanged parameters are replaced by the unified Value / ValueChanged. Use an array or IReadOnlyList<T> as TValue:
@bind-Dates -> @bind-Value (with TValue="DateTime[]" or TValue="IReadOnlyList<DateTime>")Dates / DatesChanged -> Value / ValueChangedFor non-range DatePicker usage:
Date / DateChanged -> Value / ValueChangedFor <Select Multiple ...>, the old SelectedValues / SelectedValuesChanged parameters are replaced by the unified Value / ValueChanged. Use an array or IReadOnlyList<T> as TValue:
@bind-SelectedValues -> @bind-Value (with TValue="string[]" or TValue="IReadOnlyList<string>")SelectedValues / SelectedValuesChanged -> Value / ValueChangedExample:
<Select TValue="int[]" @bind-Value="Selected" Multiple>
<SelectItem Value="1">One</SelectItem>
<SelectItem Value="2">Two</SelectItem>
</Select>
@code {
private int[] Selected { get; set; } = new int[] { 1 };
}
For empty placeholder items, set explicit TValue:
<SelectItem></SelectItem> -> <SelectItem TValue="string"></SelectItem> (or another correct type such as Guid?)CurrentPage -> Page on DataGridImportant: AbpExtensibleDataGrid still uses CurrentPage (for example ABP v10.2). Do not rename it to Page.
Inside DisplayTemplate, use context.Item instead of directly using context.
Typical updates:
context.Property -> context.Item.PropertyMethod(context) -> Method(context.Item)() => Method(context) -> () => Method(context.Item)row.Property -> row.Item.PropertyThe same rule also applies to action handlers in DataGridEntityActionsColumn and DataGridCommandColumn (such as Clicked, Visible, and ConfirmationMessage):
Clicked="async () => await action.Clicked(context)" -> Clicked="async () => await action.Clicked(context.Item)"Visible="action.Visible(context)" -> Visible="action.Visible(context.Item)"Important: This change applies to DataGrid template contexts only (DisplayTemplate in DataGridColumn, DataGridEntityActionsColumn, etc.). In non-DataGrid templates (for example TreeView NodeContent), context is already the item and should remain unchanged (for example DeleteMenuItemAsync(context)).
DataGrid column Width moved from plain string to fluent sizing APIs:
Width="30px" -> Width="Width.Px(30)"Width="60px" -> Width="Width.Px(60)"Width="0.5rem" -> Width="Width.Px(8)" (or another equivalent pixel value)Width="50%" -> Width="Width.Percent(50)" or Width="Width.Is50"Width="100%" -> Width="Width.Is100"For dynamic string widths (for example column.Width), ABP introduces BlazoriseFluentSizingParse.Parse(...) to convert string values into IFluentSizingStyle.
Width="@BlazoriseFluentSizingParse.Parse(column.Width)" // column.Width is a string
Size and Centered should be placed on <Modal>, not on <ModalContent>.
<ModalContent Size="..." Centered="true"> -> <Modal Size="..." Centered="true"> + <ModalContent>Dropdown RightAligned="true" -> Dropdown EndAligned="true"Autocomplete MinLength -> MinSearchLengthAutocomplete usage can still involve SelectedValue / SelectedValueChanged, depending on component API.BarDropdown and Dropdown are different components; align parameter names according to the actual component type.This document may not cover all Blazorise 2.0 changes. For completeness, refer to the official migration guide and release notes: