Hello,
In this doc, we can see In this example, what looks like a redundant ContentView has been added as the root element of the EmptyView. This is because internally, the EmptyView is added to a native container that doesn't provide any context for Xamarin.Forms layout. Therefore, to position the views that comprise your EmptyView, you must add a root layout, whose child is a layout that can position itself within the root layout. It may be caused by the native container, but when I add a ContentView
, it still doesn't work. You could try to set IsVisible
of the Label
to hide this EmptyView
:
NotesPageModel
public bool EmptyViewVisibility { get; set; }
Set true
in AppearAction
public override async void AppearAction() {
......
EmptyViewVisibility = true;
}
Set false
when pushing to the new EdtorPage
public override async void SelectedItemActionAsync() {
if (SelectedItem != null) {
EmptyViewVisibility = false;
......
}
}
Bind IsVisible
on NotesPage
XAML
<Label IsVisible="{Binding EmptyViewVisibility}"
....../>
Best Regards,
Wenyan Zhang
If the answer is the right solution, 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.