Strange message that appears in the editor page

Eduardo Gomez 3,651 Reputation points
2022-04-01T15:11:00.67+00:00

I have a notebooks page, with a collection of notebookds, that has an emptyView that says "No notebooks, to add blabla bla" and the same goes for the notes, but i am seeing the same message in the Editor Page, and is not supose to be there

https://reccloud.com/u/ga2i0rt

code
https://github.com/eduardoagr/DuoNotes

What are you trying to do

I do not want to display the "No notebooks, press the + symbol" in the EditorPage, that for some reason is appearing

What code are you using to do that?

This is the code for the EdtorPage, I never use a label in that page to show that message

  <ContentPage.BindingContext>
        <vm:EditorPageModel />
    </ContentPage.BindingContext>

    <ContentPage.Behaviors>
        <community:EventToCommandBehavior Command="{Binding PageAppearCommand}" EventName="Appearing" />
        <community:EventToCommandBehavior Command="{Binding PageDisappearCommand}" EventName="Disappearing" />
    </ContentPage.Behaviors>

    <NavigationPage.TitleView>
        <StackLayout HorizontalOptions="FillAndExpand" Orientation="Horizontal">
            <Label
                Text="{Binding Note.Name}"
                FontSize="Medium"
                TextColor="{StaticResource BackgroundLigthColor}"
                VerticalTextAlignment="Center" />
            <Button
                community:TouchEffect.Command="{Binding ShareCommand}"
                community:TouchEffect.PressedBackgroundColor="{StaticResource ToolbarPresedItems}"
                BackgroundColor="{StaticResource Trnsparent}"
                HorizontalOptions="EndAndExpand">
                <Button.ImageSource>
                    <FontImageSource FontFamily="ma" Glyph="{Static icon:MaterialIcons.ShareVariant}" />
                </Button.ImageSource>
            </Button>

            <Button
                community:TouchEffect.Command="{Binding SaveCommand}"
                community:TouchEffect.PressedBackgroundColor="{StaticResource ToolbarPresedItems}"
                BackgroundColor="{StaticResource Trnsparent}">
                <Button.ImageSource>
                    <FontImageSource FontFamily="ma" Glyph="{Static icon:MaterialIcons.ContentSave}" />
                </Button.ImageSource>
            </Button>

            <buttons:SfButton community:TouchEffect.Command="{Binding OcrCommand}"
                              BackgroundColor="{StaticResource Trnsparent}">
                <buttons:SfButton.Content>
                    <ffimageloadingsvg:SvgCachedImage
                        HeightRequest="45"
                        Source="ocr.svg"
                        WidthRequest="45" />
                </buttons:SfButton.Content>
            </buttons:SfButton>

        </StackLayout>
    </NavigationPage.TitleView>

    <StackLayout>
        <richtexteditor:SfRichTextEditor HtmlText="{Binding HtmlText}"
                                         Text="{Binding PlainText}"
                                         ToolbarOptions="Bold,Italic,Underline,Alignment,BulletList,NumberList,FontSize,FontColor,HighlightColor,Undo"
                                         ToolbarPosition="Top" />
    </StackLayout>

What is the actual behaviour that results?

To make the editor apear without the message in the background

Developer technologies .NET Xamarin
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2022-04-04T04:49:20.137+00:00

    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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.