Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Map navigation parameters to properties on navigation #16

Open
BurkusCat opened this issue Oct 4, 2023 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@BurkusCat
Copy link
Owner

BurkusCat commented Oct 4, 2023

Is your feature request related to a problem? Please describe.
Having to set basic properties in the OnNavigatedTo lifecycle method can be repetitive. It would be good if there was a way to automatically set properties with a similar name.

Describe the solution you'd like
Something similar to query properties in Shell might be nice: https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/navigation#process-navigation-data-using-query-property-attributes. This allows you to map parameter names to a navigation parameter key which may be different.

Describe alternatives you've considered
OnNavigatedTo provides an advance way to set parameters but may get repetitive. This method of parameter passing may mean you don't need to implement the INavigatedEvents interface on some viewmodels.

Proposed APIs

// as an annotation above a viewmodel you can do as many of the below as you wish:
[MapNavigationParameter(nameof(TestParam), "test_param")]

Additional context
N/A

@BurkusCat
Copy link
Owner Author

I've split this out into #61

@BurkusCat BurkusCat self-assigned this May 12, 2024
@BurkusCat BurkusCat changed the title [Feature] Auto-populate properties on navigation [Feature] Map navigation parameters to properties on navigation May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant