Hello,
Welcome to our Microsoft Q&A platform!
The problem I have is this. When the InitBase is assigned, it is running the code in the function being assigned. The function has code that can only be executed after the page has been loaded, I can add code to prevent the function from running unless a flag is set for the page being ready.
When you set the BindingContext
for your page,once the page been created, the constructor of your ViewModel will been called at the same time.
If you want some code in the constructor of your ViewModel willn't been executed , you can set some condition(e.g. a bool flag) just as you mentioned.
In addition, you can also add your code in function OnAppearing
by override function OnAppearing
:
protected override void OnAppearing()
{
base.OnAppearing();
// add your code here
}
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.