Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v7.0.0 Migration Guide #8447

Open
henon opened this issue Mar 24, 2024 · 20 comments
Open

v7.0.0 Migration Guide #8447

henon opened this issue Mar 24, 2024 · 20 comments
Labels
API change API that needs approval breaking change epic v7 New major MudBlazor version

Comments

@henon
Copy link
Collaborator

henon commented Mar 24, 2024

MudBlazor version 7.0.0 brings a ton of breaking changes which we can't postpone any longer as we strive for more consistency and necessary improvements. This migration guide shall make the upgrade process as easy as possible for you.

Note: Please limit discussion strictly to migration or reporting errors in this guide. Discussion about the changes itself belong in the linked PRs and will be deleted in this issue. If you want to give general feedback about version 7.0.0 you are welcome to do it in MudBlazor v7 Feedback.

Note

v7.0.0 is currently in preview stage, you will find the nuget if you check the Include prerelease checkbox in Visual Studio. Please expect a few more breaking changes until we finally enter the release-candidate stage.

Warning

Many parameters have been renamed to make the API more consistent, i.e. IsEnabled => Enabled. Please be aware that the compiler will NOT throw errors for unknown parameters in razor because of attribute splatting. This means, that you have to be extra careful when migrating your application from v6.x.x to v7.0.0. This is why we added an illegal parameter detection logic in MudComponentBase which will throw a runtime exception if you forgot to rename any parameters in your razor files. You can opt-out of this behavior by setting MudGlobal.EnableIllegalRazorParameterDetection = false in your app at startup. If you derived your own components from our MudComponentBase you can override the detection function DetectIllegalRazorParametersV7() for your own components. #8771 By the way, you can also use the compile-time Razor analyzer by meziantou which will give you a compiler warning for all unknown parameters.

How to Use this Guide

Since the guide itself is quite lengthy you probably won't need to read it all. But you should read all the Warning boxes as they are very important.

It is probably best if you just compile your app against the v7 nuget and use browser search to find the new parameter or method name for the renamed parameters in this guide. Once your app runs again make sure you run all your tests to find additional problems in razor which will surface as ArgumentExceptions. If you don't have full test coverage then it is advised that you do a full manual test by visiting every razor component of your UI.

.NET 6 is not supported any longer

If you need .NET 6 support you can stay on the latest v6.x.x version. If you need any bug fixes in v6 please PR and we'll release v6 updates for you.

For more details see #8441

ICommand no longer supported

This concerns the components: MudBaseButton, MudButton, MudIconButton, MudFab, MudChip, MudListItem, MudBaseSelectItem, MudNavLink, MudMenu, MudMenuItem, MudOverlay, MudTreeViewItem, MudTableBase, MudTable

  • Replace Command+CommandParameter with EventCallback<MouseEventArgs> OnClick

For more details see #8436

Unified Breakpoint Services

The services SubscriptionInfo, ResizeService, ResizeListenerService, ResizeBasedService and BreakpointService have been removed and are replaced entirely by BrowserViewportService.

For more details see #8467

Service Configuration

Some MudBlazor services hat config methods where you could directly pass options. These have been removed in favor of overloads where you pass an Action<SomeServiceOptions> which then manipuluates the options. The removed overloads are:

  • AddMudBlazorSnackbar
  • AddMudBlazorResizeListener
  • AddMudBlazorResizeObserver
  • AddMudBlazorResizeObserverFactory
  • AddMudPopoverService
  • AddMudServices

For details see #8531

Async Protected Methods now bear the Async Postfix

Several protected async methods were renamed to bear the Async postfix to comply with our naming rules. For the most part we don't list them here as they are not important for most users except those few who derived own components from ours.

Changes to Inputs

These changes concern MudTextField, MudInput and all inheriting from MudBaseInput

  • OnKeyPress is no longer supported. Use OnKeyDown instead.
  • The virtual method InvokeKeyPress was removed

If an input has no label, it now automatically shrinks in height by 4px:
image
image

For details see #8476 and #8540

Pickers

This concerns the components MudPicker, MudColorPicker, MudBaseDatePicker, MudDatePicker, MudDateRangePicker, MudTimePicker

  • Replace ClassAction with ActionsClass #8489
  • Replace InputIcon (removed obsolete) with AdornmentIcon
  • Replace InputVariant (removed obsolete) with Variant
  • Replace AllowKeyboardInput (removed, unused)
  • Replace ClassActions with ActionsClass
  • Replace Classnames with Classname
  • Replace Close() with CloseAsync()
  • Several async protected methods have been renamed to bear the Async postfix

For details see #8506 and #8517

IMudStateHasChanged related

To force a render update cast the component in question to IMudStateHasChanged and call StateHasChanged() on it. Other public ways to force a refresh have been removed

  • MudRender: ForceRender & StateHasChanged removed #8477, #8610
  • MudDialogInstance: ForceRender removed #8532
  • MudElement: Refresh removed #8610
  • MudPageContentNavigation: Update removed #8610

Accessability Changes

  • MudText: Typo.subtitle1 and Typo.subtitle2 now render as <span> instead of <h6> #6061
  • MudText: Parameter Inline was removed. Instead of Inline="true" use HtmlTag="span", the default tag remains <p>. #8916

Renamed Components

  • Replace MudAppBarSpacer and MudToolBarSpacer with MudSpacer #8475
  • Replace MudTextFieldString with MudTextfield<string> #8475

Gray is the new Grey

All usage of grey was renamed to gray in Colors, Palette and in css variables and classes. For more Details see #8452

MudTheme

  • Palette has been made abstract. #8453
  • MudTheme.Palette is now PaletteLight and is of type PaletteLight to match PaletteDark. #8453
  • ChipDefault and ChipDefaultHover color settings have been removed from MudPalette, the chips now use the normal palette settings. #8599

MudThemeProvider

  • Removed MudThemingProvider. #8712

Warning

It's now explicitly required to add MudPopoverProvider. #8712

Before (v6.x.x):

<MudThemeProvider/>
<MudDialogProvider/>
<MudSnackbarProvider/>

After (v7.x.x):

<MudThemeProvider/>
<MudPopoverProvider/>
<MudDialogProvider/>
<MudSnackbarProvider/>

Icons

  • Replace Icons.Filled with Icons.Material.Filled
  • Replace Icons.Outlined with Icons.Material.Outlined
  • Replace Icons.Rounded with Icons.Material.Rounded
  • Replace Icons.Sharp with Icons.Material.Sharp
  • Replace Icons.TwoTone with Icons.Material.TwoTone

See #8421, #8536 for more details.

Inverted Negative Parameters

For more consistency negative parameter names were renamed and inverted. You need to do the same, make sure to invert the boolean value or condition for these parameters! This change concerns the components: MudButton, MudSelectItem, MudFab, MudToggleIconButton, MudCheckBox, MudListItem, MudMenu, MudNavGroup, MudRadio, MudRatingItem, MudSwitch, MudToggleGroup, MudList, MudListItem, AppBar, ToolBar, ExpansionPanel and possibly some others as well:

  • Replace DisableRipple with Ripple and invert the value. #8571
  • Replace DisableGutters with Gutters and invert the value. #8580
  • Replace DisablePadding with Padding and invert the value. #8613
  • Replace DisableElevation with DropShadow and invert the value #8592
  • Replace DisableUnderLine with Underline and invert the value #8591
  • Replace DisableRowsPerPage with PageSizeSelector and invert the value. #8662
  • ChartOptions: replace DisableLegend with ShowLegend and invert value #8826
  • MudPickerToolbar: replace DisableToolbar with ShowToolbar and invert value #8826
  • MudPicker: replace DisableToolbar with ShowToolbar and invert value #8826
  • MudDialog: replace DisableSidePadding with Gutters and invert value #8826
  • MudDialog: replace DisableOverlay with Overlay and invert value #8826
  • MudTabs: replace DisableSliderAnimation with SliderAnimation and invert value #8826
  • MudTimeline: replace DisableModifiers with Modifiers and invert value #8826

Other changes

  • Replace DoubleExtentions with DoubleExtensions #8473
  • Our ToDescriptionString enum extension has been removed. If you used this, please copy our code from the v6 branch to your own project. #8474
  • Replace Link with Href in MudChip, MudMenuItem, MudButton, MudIconButton, MudFab and MudBaseButton #8471
  • MudBreadcrumbs: Item now uses IReadOnlyList instead of List. #4728
  • MudBadge: Replace Bottom, Left, Start with Origin #8475
  • ToolTip: Replace usage of Delayed with Delay#8475
  • Replace OverFlowBehavior.FilpOnOpen with FlipOnOpen#8475
  • MudRadio: Select renamed to SelectAsync #8477
  • MudSelect: Replace ClearAsync with Clear #8477
  • Task: An overload of AndForget with enum parameter was removed in favor of one with a bool parameter. See #8531
  • NumericConverter: AreEqual removed, use DoubleEpsilonEqualityComparer.Default.Equals #8531
  • ColorManager and ColorTransformation removed in favor of MudColor #8531
  • MudAlert: Replace AlertTextPosition with ContentAlignment #8532
  • AlertTextPosition enum completely removed #8637
  • MudCarousel: Replace ShowDelimiters with ShowBullets and DelimitersColor with BulletsColor #8532
  • MudChart: Replace InterpolationRequired removed from ILineInterpolator and NoInterpolation class removed. There is no replacement #8532
  • MudCollapse: Replace AnimationEnd with AnimationEndAsync #8532
  • MudForm: Replace Reset with ResetAsync #8532
  • MudProgressCircular and MudProgressLinear: Replace Minimum with Min and Maximum with Max #8532
  • MudRadio: Replace Option with Value #8532
  • MudTextField: Replace ResetValue with ResetValueAsync #8532
  • MudFab: Replace Icon with StartIcon #8532
  • MudCheckBox and MudSwitch: Replace Checked with Value #8564
  • ScrollManager: Several methods are now async, so they have now the Async postfix. The obsolete property Selector was removed. #8564
  • MudTabs: Several CSS classes were renamed. Replace mud-tabs-toolbar to mud-tabs-tabbar in all css classes, i.e.: Use mud-tabs-tabbar-transparent instead of mud-tabs-toolbar-transparent. #8569
  • MudPopover: Replace Direction, OffsetX, OffsetY with AnchorOrigin and TransformOrigin #8475
  • MudToggleGroup: Change Outline to Outlined #8616
  • MudToggleGroup: removed Dense in favor of Size #8676
  • MudAvatar: Removed Image and Alt parameters. Replaced with a MudImage as the ChildContent instead #8648
  • MudSlider:: Removed parameter Text and constrained type parameter to INumber. #8745
  • GroupDefinition: Replace IsExpandedChanged with ExpandedChanged #8718
  • MudVirtualize: Replace IsEnabled with Enabled #8764
  • MudPopoverProvider: Replace IsEnabled with Enabled #8764
  • MudCheckBox and others: Replace UnCheckedColor with UncheckedColor #8759
  • ButtonGroup: Rename VerticalAlign to Vertical #8798
  • MudRatingItem: replace IsChecked with Checked #8825
  • MudTableGroupRow: replace IsCheckable with Checkable #8825
  • MudTableGroupRow: replace IsChecked with Checked #8825
  • MudTFootRow: replace IsCheckable with Checkable #8825
  • MudTFootRow: replace IsChecked with Checked #8825
  • MudTHeadRow: replace IsCheckable with Checkable #8825
  • MudTHeadRow: replace IsChecked with Checked #8825
  • MudTr: replace IsCheckable with Checkable #8825
  • MudTr: replace IsCheckedChanged with CheckedChanged #8825
  • MudTr: replace IsChecked with Checked #8825
  • MudPicker: replace ToolBarClass with ToolbarClass #8826
  • MudCarouselItem: replace IsVisible with Visible #8832
  • ChartSeries: replace IsVisible with Visible #8832
  • SvgLegend: replace IsVisible with Visible #8832
  • MudDialog: replace IsVisible with Visible #8832
  • MudDialog: replace IsVisibleChanged with VisibleChanged #8832
  • MudMessageBox: replace IsVisible with Visible #8832
  • MudMessageBox: replace IsVisibleChanged with VisibleChanged #8832
  • MudTooltip: replace IsVisible with Visible #8832
  • MudTooltip: replace IsVisibleChanged with VisibleChanged #8832
  • MudSlider: Use NullableValue instead of Value if you need to bind a nullable type #8881
  • MudSlider: The type of ValueLabelContent changed from RenderFragment<T> to RenderFragment<SliderContext<T>> #8881
  • MudListItem and MudMenuItem: When Href is set the underlying html element is rendered as <a> instead of <div> #8649
  • CellContext: replace IsSelected with Selected #8886
  • MudAppbar: Removed AppbarMinHeight. #8568
  • MudDropZone: replace ItemIsDisabled with ItemDisabled #8887
  • MudDropContainer: replace ItemIsDisabled with ItemDisabled #8887
  • MudPageContentSection: replace IsActive with Active #8888
  • CellContext: replace IsOpened with Open #8891
  • MudMenu: replace IsOpenChanged with OpenChanged #8891
  • MudMenu: replace IsOpen with Open #8891
  • MudCard: Card content now fills remaining vertical space by default #8933
  • MudHidden: replace IsHidden with Hidden #8952
  • MudHidden: replace IsHiddenChanged with HiddenChanged #8952

MudAutocomplete

  • SearchFunc got an extra argument for a CancellationToken and SearchFuncWithCancel was removed #8490
  • The increment parameter was removed from the ScrollToListItem method #8477
  • Replace Direction with AnchorOrigin or TransformOrigin #8532
  • Replace OffsetX with AnchorOrigin or TransformOrigin #8532
  • Replace OffsetY with AnchorOrigin or TransformOrigin #8532
  • Replace ChangeMenuAsync with OpenMenuAsync and CloseMenuAsync #8787
  • Rename SelectOnClick to SelectOnActivation #8787
  • MudAutocomplete: replace IsOpenChanged with OpenChanged #8891
  • MudAutocomplete: replace IsOpen with Open #8891
  • MudAutocomplete: ItemDisabledTemplate and ItemSelectedTemplate will now display even if ItemTemplate is not defined. #8913
  • MudAutocomplete: Renamed SelectOption to SelectOptionAsync #8990
  • MudAutocomplete: Renamed Clear to ClearAsync #8990

MudChipSet and MudChip

Both are now generic and MudChipSet<T> selection is now data driven which means that it only selects values not MudChips.

  • Replace <MudChip> with <MudChip T="string"> or any other type for T except if it is used inside a MudChipSet from which it automatically inherits the type parameter. #4342
  • Replace <MudChipSet> with <MudChipSet T="string"> or any other type for T. #4342
  • MudChip: Replace Avatar and AvatarClass with AvatarContent #4342
  • MudChip: Replace Link with Href #4342
  • MudChipSet: Replace Filter with CheckMark #4342
  • MudChip: Replace DisableRipple with Ripple but make sure to invert the boolean expression. #4342
  • MudChip: In general, set Value instead of Text, use Text only for displaying a different text than the assigned value. Only for T="string" when you don't set Value then Text is used instead as before. For all other types, you must set Value. #4342
  • MudChipSet: Replace the dual parameters MultiSelection and Mandatory with SelectionMode. MultiSelection="true" corresponds to SelectionMode.MultiSelection. For the default single-selection of the old chip set use SelectionMode.ToggleSelection. The old MultiSelection="false" Mandatory="true" corresponds to SelectionMode.SingleSelection. #8722

Correspondence of old parameters to the new selection mode (#8722):

MultiSelection Mandatory SelectionMode
true * SelectionMode.MultiSelection
false true SelectionMode.SingleSelection
false false SelectionMode.ToggleSelection

Warning

Due to the unification of selection features over all components the default selection mode of MudChipSet has changed. Prior to v7 chips could be selected off by default. In v7 the default is SelectionMode.SingleSelection (like for all other components that support parameter SelectionMode) which does not allow to de-select chips by clicking again. Set to SelectionMode.ToggleSelection for that. #8722

  • MudChipSet: Replace SelectedChip and SelectedChips with SelectedValue and SelectedValues #4342
  • Several other methods renamed or removed, you'll probably need to rewrite code using chip set. See PR #4342 for further details.
  • MudChip: replace IsSelected with Selected #8886
  • MudChip: replace IsSelectedChanged with SelectedChanged #8886

MudColorPicker

  • Replace DisableSliders with ShowSliders and invert value #8826
  • Replace DisablePreview with ShowPreview and invert value #8826
  • Replace DisableModeSwitch with ShowModeSwitch and invert value #8826
  • Replace DisableInputs with ShowInputs and invert value #8826
  • Replace DisableDragEffect with DragEffect and invert value #8826
  • Replace DisableColorField with ShowColorField and invert value #8826
  • Replace DisableAlpha with ShowAlpha and invert value #8826

MudDialog

The changes below concern the classes MudDialog, MudDialogOptions, MudDialogInstance and MudDialogProvider and DialogResult

  • Replace ClassBackground with BackgroundClass #8458
  • Replace ClassAction with ActionsClass #8481
  • Replace ClassContent with ContentClass #8481
  • AreParametersRendered was removed, it had no function #8475
  • Replace Cancelled with Canceled #8475
  • The namespace MudBlazor.Dialog was removed completely. #8564
  • DialogOptions: Rename DisableBackdropClick to BackdropClick and invert the condition
  • MudDialog: public DialogService was made protected. #8925
  • MudDialog: Show() renamed to Task ShowAsync(). #8925
  • MudDialog: Close() renamed to Task CloseAsync(). #8925

MudDrawer

  • Removed DrawerWidth. #8568
  • Removed DrawerHeightTop. #8568
  • Removed DrawerHeightBottom. #8568

MudExpansionPanels

  • Replace IsExpanded with Expanded #8718
  • Replace IsExpandedChanged with ExpandedChanged #8718
  • Replace IsInitiallyExpanded="true" with Expanded="true" or use @bind-Expanded="_expanded" where _expanded is true as initial value.
  • Replace CollapseAll() with CollapseAllAsync()
  • Replace CollapseAllExcept(...) with CollapseAllExceptAsync(...)
  • Replace CloseAllExcept() with CollapseAllExceptAsync(...)
  • Replace ExpandAll() with ExpandAllAsync()
  • Replace UpdateAll() with UpdateAllAsync()
  • RemovePanel(...) is not public any more. If you used it, you have to change your code to a more blazoresque coding style where the panels are created from a list. Removing a panel can then be done by removing it from the list and calling StateHasChanged.

For more details see #8446

MudExpansionPanel

  • Replace ToggleExpansion() with ToggleExpansionAsync()
  • Replace Expand() with ExpandAsync()
  • Replace Collapse() with CollapseAsync()

For more details see #8446

MudFileUpload

  • Breaks visuals by removing the top margin:
    226110772-4babc9c5-cc60-49c0-ac4b-90652838e6db For more details see #6483
  • MudFilePicker: Replace ButtonTemplate with ActivatorContent. Any MudButton within ActivatorContent now activates the file picker. #8694

MudFormComponent

This concerns all inputs which inhert from MudFormComponent, such as MudTextField, MudCheckBox, MudSwitch, MudFileUpload, etc.

  • Replace BeginValidateAfter with BeginValidationAfterAsync and BeginValidate with BeginValidateAsync #8564
  • Replace Reset and ResetValue with ResetValueAsync #8564

MudGrid

Warning

To unify spacing accross the library the default spacing unit in MudGrid was changed (halved from 8px to 4px). To keep the gaps the same as in v6 you need to double the value of the Spacing parameter. #8910

If you didn't set a value vor Spacing, you don't have to do anything as we already doubled the default value. Of course the maximum allowable spacing has also been increased from 10 to 20.

MudList

MudList and MudListItem are now generic <T> so you can bind any type to SelectedValue. This means you now must specify T, even if you don't use the selection feature. #8613

  • MudList: SelectedItem has been removed. The selection is solely managed via SelectedValue which you should bind. #8613
  • MudList: Renamed Clickable to ReadOnly and inverted conditions. #8613
  • MudList: Removed any pre-conditions for selection to work, such as binding SelectedValue. Lists are interactive by default now. If the list is ReadOnly, the selection will still be shown but can't be changed, if Disabled no selection shows. #8613
  • MudList: Renamed DisablePadding to Padding and inverted conditions #8613
  • MudList: Removed Avatar and AvatarClass in favor of AvatarContent render fragment #8677
  • MudListItem: Removed InitiallyExpanded, just set Expanded to true #8613
  • MudListItem: For T="string", you can just set Text if the Value is the same so you don't have to repeat yourself. This also means you don't have to set a value if you only have a (unique) Text and you won't get selection problems. In the old list you had to set a unique Value just so the selection mechanism worked. #8613
  • MudListItem: Replace AdornmentColor with ExpandIconColor #8775
  • MudListItem: Renames parameter OnClickHandlerPreventDefault to OnClickPreventDefault#8775

MudRadioGroup

  • ResetValue renamed to ResetValueAsync. #8477
  • Replace SelectedOption with Value instead. #8568
  • Replace SelectedOptionChanged with ValueChanged instead. #8568

MudSelect

  • Replace Direction with AnchorOrigin or TransformOrigin #8532
  • Replace OffsetX with AnchorOrigin or TransformOrigin #8532
  • Replace OffsetY with AnchorOrigin or TransformOrigin #8532

MudSnackbar

  • Replace usage of the SnackbarService method AddNew with Add #8475
  • SnackbarService: The method Add(string message, ...) does not support MarkupString any longer for security reasons. We added an overload Add(MarkupString message, ...). #8156

MudSwipeArea

  • GetSwipeDelta removed. Use OnSwipeEnd instead #8568
  • OnSwipe removed. Use OnSwipeEnd instead #8568

MudTable

  • ServerData got an extra argument for a CancellationToken #8407
  • RightAlignSmall removed as not needed any longer, the cells width/alignment is done automatically.. #8532
  • MudTablePager: Replace DisableRowsPerPage with HideRowsPerPage #8532
  • MudTHeadRow: replace IsExpandable with Expandable #8718
  • MudTFootRow: replace IsExpandable with Expandable #8718
  • MudTableGroupRow: replace IsExpanded with Expanded #8718
  • MudTr: replace IsExpandable with Expandable #8718
  • MudTr: replace IsEditable with Editable #8892
  • MudTr: removed IsEditing and IsEditSwitchBlocked #8892
  • TableButtonPositionExtentions: replace IsEditable with Editable #8892
  • MudTable: removed QuickColumns property and MudColumn that was used to generate table when no Columns and Rows were present. We no longer want to use reflection in MudTable, so we removed this undocumented feature. #8927
  • TableRowHoverEventArgs and Table methods now accept PointerEventArgs instead of MouseEventArgs #8974

MudTreeView

  • CanActivate was removed, it is no longer needed. #8475
  • Replace CanHover with Hover #8475
  • CanSelect removed. Use MultiSelection instead #8532
  • Replace ActivatedValueChanged with SelectedValueChanged #8532
  • MudTreeView: Selection is now active by default. Use ReadOnly for a non-selectable treeview. #8661
  • MudTreeView: The boolean parameter Multiselection has been replaced by parameter SelectionMode with enum values { SingleSelection, MultiSelection, ToggleSelection } #8661
  • MudTreeView: Parameter Items now uses IReadOnlyCollection<T> #8661
  • MudTreeViewItem: Parameter Actived was removed. Use Selected instead #8661

Warning

MudTreeViewItem: Parameter ExpandedIcon was removed. Use ExpandButtonIcon instead to set a custom glyph for the expand button. This is not to be confused with the new parameter IconExpanded which is a new feature to allow showing an alternate icon in expanded state instead of Icon. #8661

  • MudTreeViewItem: Parameter Items and ServerData now use IReadOnlyCollection<T> #8661

MudDrawer

  • INavigationEventReceiver.OnNavigation() is implemented now explicitly. #8532
  • Removed PreserveOpenState as it is not needed any longer. #8833

MudDataGrid

  • Removed FilterDefinition.GenerateFilterExpression() replace with FilterExpressionGenerator.GenerateExpression
  • Removed other old APIs from FilterDefinition that was replaced by IFilterDefinition API.
  • FilterContext.FilterActions all properties are marked as required.
  • FooterContext.FooterActions all properties are marked as required.
  • HeaderContext.SetSelectAllAsync all properties are marked as required.
  • HeaderContext.IsAllSelected changed type from bool to bool?.
  • Column: replace IsEditable with Editable

For more details see #8548, #8317, #8892

MudMenu

  • The parameters Link, Target, HtmlTag and ButtonType were removed. They had no function. #8475
  • ToggleMenu is renamed to ToggleMenuAsync #8317
  • CloseMenu is renamed to CloseMenuAsync #8317
  • OpenMenu is renamed to OpenMenuAsync #8317
  • MouseEnter is not public API anymore. #8317
  • MouseLeave is not public API anymore. #8317

MudMenuItem:

  • UriHelper changed visibility from public to protected. #8317
  • JsApiService changed visibility from public to protected. #8317
  • Activate(object, MouseEventArgs) is now implemented explicitly IActivatable.Activate(object, MouseEventArgs) #8317
  • Overload void Activate(object, TouchEventArgs) was removed. #8317
@henon henon changed the title v7 Migration Guide v7.0.0 Migration Guide Mar 24, 2024
@henon henon added breaking change API change API that needs approval v7 New major MudBlazor version labels Mar 24, 2024
@henon henon pinned this issue Mar 26, 2024
@Seanxwy
Copy link

Seanxwy commented Apr 1, 2024

When is it expected to be released

@zackasattackas
Copy link

I just want to say that I am very excited for this release! Huge thank you to everyone who contributed their time and energy to making this happen 🙏

@stephajn
Copy link

stephajn commented May 1, 2024

I'm glad that you've been giving Obsolete warnings throughout the lifetime of v6.x. I wish the Blazor compiler did more to help raise those when compiling, but that's on Microsoft to fix.

You guys have done a fantastic job, and thank you for only breaking on a major release, and not a minor one like Microsoft's Graph package. You're doing a fantastic job, and this migration guide is invaluable!

@henon
Copy link
Collaborator Author

henon commented May 2, 2024

I'm glad that you've been giving Obsolete warnings throughout the lifetime of v6.x.

Yes, but not all breaking changes we made in v7 have been preceeded by obsoletion warnings. While working on v7 we discovered a lot more inconsistencies and rectified them on the spot.

I wish the Blazor compiler did more to help raise those when compiling, but that's on Microsoft to fix.

Yes, but we have added runtime exceptions for renamed parameters and there is also a new approach in the works by @peterthorpe81 who is tinkering with a compile time analyzer: #8771 (comment)

@digitaldirk
Copy link
Contributor

digitaldirk commented May 3, 2024

Some things I ran into that I could not find in this guide:
DialogOptions - DisableBackdropClick -> BackdropClick, this needs to be added to the inverted negative parameters section?

MudDatePicker - datePicker.Close() -> await datePicker.CloseAsync

For MudList and MudListItem I couldn't set T in my project. I restarted Visual Studio then it started working, just an FYI if anyone encounters this.

@henon
Copy link
Collaborator Author

henon commented May 3, 2024

Thanks for reporting @digitaldirk, I've updated the guide.

@digitaldirk
Copy link
Contributor

Minor one for MudColorPicker - ShowToolbar is now defaulted to true so you need to set that to false to get previous default.

@henon
Copy link
Collaborator Author

henon commented May 4, 2024

Minor one for MudColorPicker - ShowToolbar is now defaulted to true so you need to set that to false to get previous default.

Hmm, maybe we should revert that to false? Sounds like an oversight to me. Edit: done in f98e9a1

@ScarletKuro
Copy link
Member

Created a discussion topic MudBlazor v7 Feedback

@digitaldirk
Copy link
Contributor

MudToggleGroup removed Dense, you get an error but not in this guide @henon

@Joedmin
Copy link

Joedmin commented May 19, 2024

Hi, I need some help with using the MudChipSet in the v7.0.0. How are you supposed to bind the SellectedValues? I see that it wants to have an IReadOnlyCollection<T> instead of ICollection<T>

@ScarletKuro
Copy link
Member

Hi, I need some help with using the MudChipSet in the v7.0.0. How are you supposed to bind the SelectedValues? I see that it wants to have an IReadOnlyCollection<T> instead of ICollection<T>

Can you provide more details on the problem you are experiencing and show your code?

If you need to update the SelectedValues from the code side, you can simply assign an updated collection to the two-way bound variable of the SelectedValues. You can use any collection for it that supports the IReadOnlyCollection interface.

@Joedmin
Copy link

Joedmin commented May 19, 2024

Of course! I use MudChipSet to display select enum flags that I then use.

<MudChipSet T="MyEnymFlags" SelectionMode="SelectionMode.MultiSelection" @bind-SelectedValues="SelectedFlags">
	@foreach (var value in Enum.GetValues<MyEnymFlags>())
	{
		<MudChip Color="Color.Primary" Variant="Variant.Text" Size="Size.Small" Value="@value">@value.Humanize(LetterCasing.Sentence)</MudChip>
	}
</MudChipSet>

and

public List<MyEnum> SelectedFlags { get; set; } = new();

With the provided code, I get CS1503 Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback<System.Collections.Generic.List<Namespace.MyEnymFlags>>' to 'Microsoft.AspNetCore.Components.EventCallback' (logically).

Idon't want to use the IReadOnlyCollection interface as I want to be able to modify values in the SelectedFlags property from my MudChipSet. When I changed the property§s type to the required IReadOnlyCollection<MyEnumFlags, I contantly get back empty collection, as it is readonly.

So, to summarize what I'm trying to fix: I want to be able to edit the collection's values from the MudChipSet as in pre-7.0.0. versions

@henon
Copy link
Collaborator Author

henon commented May 20, 2024

@Joedmin Here is how you update the collection:

// add values to the flags:
SelectedFlags = SelectedFlags.Concat(new[] { MyEnum.Value69 }).ToList();

// remove values from the flags:
SelectedFlags.Remove(MyEnum.Value69);
SelectedFlags = SelectedFlags.ToList();

To sum up, you need to pass a different list every time it changes so that we can detect the change. If you pass the same list reference chipset will think nothing has changed because it doesn't expect a read-only collection to change.

Edit: To get rid of your error you need to change

public List<MyEnum> SelectedFlags { get; set; } = new();

to

public IReadOnlyCollection<MyEnum> SelectedFlags { get; set; } = Array.Empty<MyEnum>();

and change the selected flags like I showed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API change API that needs approval breaking change epic v7 New major MudBlazor version
Projects
None yet
Development

No branches or pull requests

10 participants