Search code examples
androidviewpopupstatemaui

Problems trying changing states in Maui with DrawingView


I´m using a DrawView in Maui Android to get the sign of a person. I get perfectly the stream of the image, create a pdf with that image and then Navigate to the next view perfectly. I am binding the Enable Property MVVM of the button sign to allow save the image after make any draw. It works all things perfectly. But here is my problem, during the process of getting the image and creating pdf, I´m trying to disable the properties of the buttons to avoid user interactions, but they don´t change the states on user Interface... I repeat MVVM pattern works perfectly. All process works fine. I´m trying another thing that is to show a popup during this process and then close it when navigates to next page. But popup not shows, it shows WHEN i have navigated to the next Page.

Could it be because during the process of getting the image, the user interface is frozen and nothing can be shown in this view?

I let only the Contentpage code because MVVM works fine...

Tanks in advance

<Grid
    RowDefinitions=".8*,.2*"
    ColumnDefinitions="*,*">

    <toolkit:DrawingView
           x:Name="DrawView"
           Grid.ColumnSpan="2"
           LineColor="Black"
           LineWidth="5" 
           IsMultiLineModeEnabled="True"
           ShouldClearOnFinish="False"
           DrawingLineStartedCommand="{Binding EnableSignButtonCommand}"
           Margin="15"/>

    <ActivityIndicator 
        IsRunning="{Binding ActivityIndicatorEnable}"
        Grid.Row="1"/>

    <Button
        Grid.Row="1"
        Text="Cancelar"
        IsEnabled="{Binding IsCancelButtonEnabled}"
        HorizontalOptions="Center"
        VerticalOptions="Center"
        WidthRequest="120"
        HeightRequest="70"
        BackgroundColor="Red"
        FontSize="Medium"
        Command="{Binding CancelCommand}"/>


    <Button
        Grid.Row="1"
        Grid.Column="1"            
        Text="Guardar"
        IsEnabled="{Binding IsSignButtonEnabled}"
        HorizontalOptions="Center"
        VerticalOptions="Center"
        WidthRequest="120"
        HeightRequest="70"
        FontSize="Medium"
        BackgroundColor="Green"
        Command="{Binding GeneratePdfCommand}"/>

</Grid>

I need to know why i can´t show the changes in my view


Solution

  • In your above code, await your show popup code. await ShowPopup();

    Or await the popup at the first place

    Ex:

    var result = await this.ShowPopupAsync(popup, CancellationToken.None);