BurkusCat / Burkus.Mvvm.Maui

A simple MVVM framework for .NET MAUI. It provides: navigation, lifecycle events, parameter passing, native dialog abstractions, and testability.
MIT License
27 stars 5 forks source link

[Feature] Easier back button press handling - source generator #48

Closed BurkusCat closed 10 months ago

BurkusCat commented 10 months ago

Is your feature request related to a problem? Please describe. Having to override ContentPage etc. with BurkusContentPage is a hassle.

Describe the solution you'd like Source generators should automatically add the below code to any ContentPage etc:

    protected override bool OnBackButtonPressed()
    {
        return BackButtonNavigator.HandleBackButtonPressed();
    }

Describe alternatives you've considered N/A

Proposed APIs A builder method to disable the automatic behaviour? Should there still be a way to manually set this on each page?

Additional context How would this work with pages defined in code rather than in.xaml.cs?