Closed shugaoye closed 1 year ago
First of all - could you describe your use case? Why do you want to override it?
There is no easy way to override OnAppearing method.
However, there's also Appearing
event in Maui controls, which maps to OnAppearing
EventCallback property. Most likely it will work for your needs. You can take a look at the example here:
https://github.com/Dreamescaper/BlazorBindings.Maui/blob/e3f5005785107713462314566de04ea24a05c4db/samples/FluxorSample/ForecastPage.razor#L9
There is no easy way to override OnAppearing method.
However, there's also
Appearing
event in Maui controls, which maps toOnAppearing
EventCallback property. Most likely it will work for your needs. You can take a look at the example here:
Thanks! I will try this. I want to initialize some data in OnAppearing().
I assume that the question is answered. Let me know it you have any other questions!
I assume that the question is answered. Let me know it you have any other questions! Yes. It's good for me now.
We can override content page method
OnAppearing()
in XAML. Is there a way to do the same in Razor page?Razor page uses
OnInitialized()
,OnParametersSetAsync()
orOnAfterRenderAsync()
etc., but these methods cannot replaceOnAppearing()
,OnNavigated()
etc. content page life cycle methods.I can create a derived class of content page to override lifecycle methods such as
OnAppearing()
.It seems this cannot work. It got the below error message.