Srinadh Battu
Srinadh Battu

Reputation: 1

page state management in maui blazor hybrid mobile app

i want to manage the page state like stack in the Maui Blazor hybrid mobile application. and also need to handle the navigation keys in the android system.

i already tried this with navigation manager but state is not managing. and also not able to handle the android navigation keys like (back button)

Upvotes: 0

Views: 368

Answers (1)

Jianwei Sun - MSFT
Jianwei Sun - MSFT

Reputation: 4332

Well, as an answer, you can try the solution of this case: Maui сhange navigation in BlazorWebView.

and also not able to handle the android navigation keys like (back button) .

Use the following code, I can hit it when I use back button:

public class MainActivity : MauiAppCompatActivity
{
    public override bool DispatchKeyEvent(KeyEvent? e)
    {
        if ((e.KeyCode == Keycode.Back) && (e.Action == KeyEventActions.Down))
        {
            Console.WriteLine(e.KeyCode);
        }
        return base.DispatchKeyEvent(e);
    }
}

Upvotes: 0

Related Questions