Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Unable to set property 'OnBackdropClick' on object of type 'MudBlazor.MudDialog' in .Net8

$
0
0

After upgrading the project from .NET 7 to .NET 8, many MudBlazor components are not functioning as expected. For example, with MudDialog, if I use OnBackdropClick, I encounter this error:

Error: System.InvalidOperationException: Unable to set property 'OnBackdropClick' on object of type 'MudBlazor.MudDialog'. The error was: Unable to cast object of type 'System.Action' to type 'Microsoft.AspNetCore.Components.EventCallback`1[Microsoft.AspNetCore.Components.Web.MouseEventArgs]'. ---> System.InvalidCastException: Unable to cast object of type 'System.Action' to type 'Microsoft.AspNetCore.Components.EventCallback`1[Microsoft.AspNetCore.Components.Web.MouseEventArgs]'.   at Microsoft.AspNetCore.Components.Reflection.PropertySetter.CallPropertySetter[TTarget,TValue](Action`2 setter, Object target, Object value)   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.<SetProperties>g__SetProperty|3_0(Object target, PropertySetter writer, String parameterName, Object value)   --- End of inner exception stack trace ---   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.<SetProperties>g__SetProperty|3_0(Object target, PropertySetter writer, String parameterName, Object value)   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.SetProperties(ParameterView& parameters, Object target)   at Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(ParameterView parameters)   at MudBlazor.State.ParameterSet.SetParametersAsync(Func`2 baseSetParametersAsync, ParameterView parameters)

I set the interactivity of the component to InteractiveServer, but no chance

<MudDialog @rendermode="RenderMode.InteractiveServer" OnBackdropClick="HandleBackdropClick">

I also set the interactivity of:

  • HeadOutlet and Routes in the App.razor file
  • MudThemeProvider, MudDialogProvider and MudSnackbarProvider in the MainLayout.razor file

This issues on GitHub did not help me resolve the error:

#7774#7510


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>