A Microsoft framework for building cross-platform mobile apps using .NET and C# with native performance and user interfaces.
Hello,
Welcome to our Microsoft Q&A platform!
My suspicions are that the empty contractor doesn't initialize an ObservableCollection
Because the 'NotebookAction' will not be called automatically, the action is just initialized in the constructor method of 'NotesPageModel' class. To exectue the action, you need to call action.Invoke(...) command. You could try using 'PageAppearCommand' instead as the 'MainPage' did.
Here is the sample code, you could refer to it.
public class NotesPageModel : MainPageModel
{
public ICommand PageAppearCommand { get; set; }
public NotesPageModel()
{
FabAnimationCommmand = new Command<Frame>(AnimateButtonCommand);
PageAppearCommand = new Command(NotePageAppearAction);
}
private void NotePageAppearAction(object obj)
{
App.FirebaseServices.ReadAsync(AppConstant.Notes, Application.Current.Properties["notebook_id"] as string);
}
...
}
NotesPage.xaml
<ContentPage x:Class="DuoNotes.View.NotesPage" ...>
<ContentPage.BindingContext>
<vm:NotesPageModel />
</ContentPage.BindingContext>
<ContentPage.Behaviors>
<community:EventToCommandBehavior Command="{Binding PageAppearCommand}" EventName="Appearing" />
</ContentPage.Behaviors>
...
</ContentPage>
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.