Comments (4)
You have to do this at MauiProgram.cs
.UsePrism(prism =>
{
prism.RegisterTypes(cr =>
{
//cr.RegisterForNavigation<NavigationPage>();//This is not necesarry
cr.RegisterForNavigation<MainPage>();
});
prism.CreateWindow(async (container, navigation) =>
{
var result = await navigation.NavigateAsync($"/{nameof(NavigationPage)}/{nameof(MainPage)}");
});
})
At App.xaml.cs
public App()
{
InitializeComponent();
//MainPage = new AppShell();//This is not necesarry
}
And voilá
from prism.
Thanks you @carlosxjose, turns out (per your comment) the issue in my main project was the registration of the NavigationPage
.UsePrism(prism =>
{
prism.RegisterTypes(cr =>
{
cr.RegisterForNavigation<NavigationPage>(); // THIS IS THE PROBLEM
});
prism.CreateWindow(async (container, navigation) =>
{
var result = await navigation.NavigateAsync($"/{nameof(NavigationPage)}/{nameof(MainPage)}");
});
})
This has fixed the crashing but has also caused a styling issues. I am currently styling like this, which worked in Xamarin
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="{DynamicResource NavigationBarColour}" />
<Setter Property="BarTextColor" Value="{DynamicResource NavigationBarTextColour}" />
</Style>
The DynamicResource allowed me to switch between multiple themes at runtime. I understand this is a completely seperate issue, but this did work prior to 9.0.401-pre.
from prism.
@RobFrancisAu Prism does not directly use the NavigationPage but rather uses a customized PrismNavigationPage. You can simply update your style to match either of the following
<Style TargetType="NavigationPage" ApplyToDerivedTypes="True">
</Style>
<Style TargetType="prism:PrismNavigationPage">
</Style>
from prism.
Fantastic, thanks @dansiegel ! That did the trick.
from prism.
Related Issues (20)
- [BUG] [Regions] [FlyoutPage] View discovery on FlyoutPage
- [Enhancement] [Regions] Add 'AddOrReplace' to IRegionBehaviorFactory HOT 3
- [BUG] In some cases, my Dedug will suddenly get stuck HOT 1
- [BUG] Popup Dialogs are hidden/covered by calling Page when called after returning from MAUI FilePicker HOT 4
- [BUG] Plugin.Popups.Maui on iOS navigate to new page when showing popup Page HOT 10
- [BUG] Absolute navigation not working on iOS HOT 3
- [BUG] Wiring view models for pages in tabbed page are done by name HOT 1
- [BUG] Popup Dialog can't fullscreen and also DialogLayout.CloseOnBackgroundTapped not working. HOT 4
- Add CloseDialog to IDialogService or Extension Method
- [BUG] Prism and MauiCompatibility are incompatibile on Windows HOT 5
- [BUG] Page.OnBackButtonPressed not called in MAUI Android HOT 8
- [BUG] Android hardware back button causes app to go to background when pressed on a TabbedPage inside a NavigationPage
- [BUG] Navigation Uri results in NullReferenceException
- [BUG] GoBackTo/GoBack can't return to a tabbed page HOT 4
- [BUG] BindingContext never cleared on Android after #3151 was merged
- [Enhancement] [TabbedPage] Configure TabbedPage Title HOT 4
- [BUG] CS8012 on publish net8.0-ios HOT 1
- [BUG] Popup Dialog does not open when called from a Service after using Absolute Navigation.
- [BUG] Object reference not set to an instance of an object when UseMauiCompatibility is enabled
- [BUG] Different Navigation Result between NavigateAsync(String) or NavigateAsync(Uri) when using RelativeBack() or ".." as Segment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prism.