You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since it can be assumed that any page within a Xamarin Forms Project will be used for Navigation we can dramatically simplify View Registration by introducing an Opt-In API that would allow Prism to reflect on the main assembly (where App.xaml.cs is located), and any modules that are loaded)
Proposal
Core support for this feature would come from the use of two new Attributes RegisterByConventionAttribute and RegisterForNavigationAttribute.
In this example we would get 4 automatically registered Views
In the event that we have opted for this sort of automatic registration, but no registrations are found at an assembly level, PrismApplication would then reflect over the exported types and evaluate any types that inherit from Page. This would occur for the assembly that the implementing App class is located in as well as for any loaded Modules. For this the Page type must declare the RegisterForNavigation attribute
[RegisterForNavigation]publicclassViewA:ContentPage{}[RegisterForNavigation("viewB")
public classViewB:ContentPage{}[RegisterForNavigation { ViewModelType =typeof(ViewCViewModel)}]publicclassViewC:ContentPage{}
As shown above the RegisterByConventionAttribute has an Automatic property. In the event that Automatic is set, any assembly level attributes will be handled, and all Exported types will be evaluated. In the event that a given Page type is not handled by either an assembly or type level RegisterForNavigationAttribute, the type will be automatically registered by convention with the type name as the navigation key.
The text was updated successfully, but these errors were encountered:
Description
Since it can be assumed that any page within a Xamarin Forms Project will be used for Navigation we can dramatically simplify View Registration by introducing an Opt-In API that would allow Prism to reflect on the main assembly (where App.xaml.cs is located), and any modules that are loaded)
Proposal
Core support for this feature would come from the use of two new Attributes
RegisterByConventionAttribute
andRegisterForNavigationAttribute
.To Opt-In you will need to decorate your App class with the
RegisterByConvention
attribute like so:When set like this Prism would then reflect over the assembly:
In this example we would get 4 automatically registered Views
RegisterForNavigation
attributeRegisterByConventionAttribute
has an Automatic property. In the event that Automatic is set, any assembly level attributes will be handled, and all Exported types will be evaluated. In the event that a given Page type is not handled by either an assembly or type level RegisterForNavigationAttribute, the type will be automatically registered by convention with the type name as the navigation key.The text was updated successfully, but these errors were encountered: