Skip to content

Commit c20eb1e

Browse files
committed
Update Blazorise 2.0 migration guide with additional input component renames and binding API changes
1 parent 02779c1 commit c20eb1e

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

docs/en/release-info/migration-guides/blazorise-2-0-migration.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Blazorise 2.0 uses new input component names:
2929
- `DateEdit` -> `DateInput`
3030
- `TimeEdit` -> `TimeInput`
3131
- `NumericEdit` -> `NumericInput`
32+
- `ColorEdit` -> `ColorInput`
33+
- `FileEdit` -> `FileInput`
3234

3335
## 3. Binding API normalization to Value/ValueChanged
3436

@@ -44,14 +46,17 @@ Migrate old binding/value APIs to the new `Value` model.
4446
- `Time` / `TimeChanged` -> `Value` / `ValueChanged`
4547
- `@bind-SelectedValue` (for `Select`) -> `@bind-Value`
4648
- `SelectedValue` / `SelectedValueChanged` (for `Select`) -> `Value` / `ValueChanged`
49+
- `@bind-Checked` (for `Switch`) -> `@bind-Value`
50+
- `Checked` / `CheckedChanged` (for `Switch`) -> `Value` / `ValueChanged`
4751

4852
## 4. DatePicker and Select multiple changes
4953

5054
### DatePicker range mode
5155

52-
For `SelectionMode="DateInputSelectionMode.Range"`:
56+
For `SelectionMode="DateInputSelectionMode.Range"`, the old `Dates` / `DatesChanged` parameters are replaced by the unified `Value` / `ValueChanged`. Use an array or `IReadOnlyList<T>` as `TValue`:
5357

54-
- `ValueChanged` -> `ValuesChanged`
58+
- `@bind-Dates` -> `@bind-Value` (with `TValue="DateTime[]"` or `TValue="IReadOnlyList<DateTime>"`)
59+
- `Dates` / `DatesChanged` -> `Value` / `ValueChanged`
5560

5661
### DatePicker single value mode
5762

@@ -61,11 +66,23 @@ For non-range `DatePicker` usage:
6166

6267
### Select multiple mode
6368

64-
For `<Select Multiple ...>`:
69+
For `<Select Multiple ...>`, the old `SelectedValues` / `SelectedValuesChanged` parameters are replaced by the unified `Value` / `ValueChanged`. Use an array or `IReadOnlyList<T>` as `TValue`:
6570

66-
- `Value` -> `Values`
67-
- `ValueChanged` -> `ValuesChanged`
68-
- `@bind-Value` -> `@bind-Values`
71+
- `@bind-SelectedValues` -> `@bind-Value` (with `TValue="string[]"` or `TValue="IReadOnlyList<string>"`)
72+
- `SelectedValues` / `SelectedValuesChanged` -> `Value` / `ValueChanged`
73+
74+
Example:
75+
76+
```razor
77+
<Select TValue="int[]" @bind-Value="Selected" Multiple>
78+
<SelectItem Value="1">One</SelectItem>
79+
<SelectItem Value="2">Two</SelectItem>
80+
</Select>
81+
82+
@code {
83+
private int[] Selected { get; set; } = new int[] { 1 };
84+
}
85+
```
6986

7087
### Empty SelectItem type requirement
7188

@@ -92,6 +109,11 @@ Typical updates:
92109
- `() => Method(context)` -> `() => Method(context.Item)`
93110
- For custom template variable names, same rule applies: `row.Property` -> `row.Item.Property`
94111

112+
The same rule also applies to action handlers in `DataGridEntityActionsColumn` and `DataGridCommandColumn` (such as `Clicked`, `Visible`, and `ConfirmationMessage`):
113+
114+
- `Clicked="async () => await action.Clicked(context)"` -> `Clicked="async () => await action.Clicked(context.Item)"`
115+
- `Visible="action.Visible(context)"` -> `Visible="action.Visible(context.Item)"`
116+
95117
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)`).
96118

97119
### 5.3 Width type change (string -> Fluent sizing)
@@ -132,3 +154,4 @@ Width="@BlazoriseFluentSizingParse.Parse(column.Width)" // column.Width is a str
132154
This document may not cover all Blazorise 2.0 changes. For completeness, refer to the official migration guide and release notes:
133155

134156
- [Blazorise 2.0 - Release Notes](https://blazorise.com/news/release-notes/200)
157+
- [Blazorise 2.0 - Migration Guide](https://blazorise.com/news/migration/200)

0 commit comments

Comments
 (0)