-
Notifications
You must be signed in to change notification settings - Fork 49
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
[Navigation] Uno.Extensions.Navigation.UI..Region Logger not set prior to navigating in MVUX project. #2159
Comments
Your system stripped out some of the markup I pasted. Here is the markup that I have in my shell.xaml file.
|
Well, again your editor tool stripped out the markup. |
After doing some regression testing, my impression is this attribute [ uen:Region.Attached="True" ] is rerouting the app hosting's initialization. Either intentionally or by causing an exception? |
I have similar issue but my error make no sense at all <UserControl x:Class="eCierge.Console.Presentation.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:eCierge.Console.Presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:uen="using:Uno.Extensions.Navigation.UI"
xmlns:utu="using:Uno.Toolkit.UI"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<utu:NavigationBar />
<NavigationView x:Name="NavView"
Grid.Row="1"
uen:Region.Attached="True"
>
<NavigationView.MenuItems>
<NavigationViewItem Content="Main" uen:Region.Name="Main" />
<NavigationViewItem Content="Second" uen:Region.Name="Second" />
</NavigationView.MenuItems>
<!--<Frame uen:Region.Attached="True"/>-->
</NavigationView>
<!--<utu:ExtendedSplashScreen x:Name="Splash"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">
<utu:ExtendedSplashScreen.LoadingContentTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition />
</Grid.RowDefinitions>
<ProgressRing IsActive="True"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Height="100"
Width="100" />
</Grid>
</DataTemplate>
</utu:ExtendedSplashScreen.LoadingContentTemplate>
</utu:ExtendedSplashScreen>-->
</Grid>
</UserControl> My shell crashes, in any case, I have |
So I've figured out what is the issue. The Hence if you try to use @nickrandolph it is very confusing! There is no mentions of such logic anywhere! I spent 1 day figuring out why this happens. Which required me to copy 2 projects from Uno.Extenstions to a sample solution from template with my code to figure out that. And calling a splash screen as shell is very confusing too. Because the shell is where you put NavigationView and TabBar. |
@weitzhandler @lukeblevins FYI too as I know you did some documentation on this front. |
@MarkAllan007 were you able to verify that my suggestion works? |
@xperiandri Sorry this error slowed you down. Glad you found a work around. No, I have not been working on a solution for this. I did trace through this apps initialization, looking at differences in the markup, leading to the exception. I do not have a stake in using Regions, yet. I was/am curious about them. I was looking .Net 8 & Uno's implementation of NavigationView/ViewItems. We can embed NavigationViewItems in user controls. I was looking at Regions, because I came across this error: #2163 In setting up my NavigtionViewItems, I found that my ShellViewModel's constructor was not being instantiated. Some slight changes in the shells xaml statement, can change something. It looks like Regions maybe a better, easier tool to use, than using NavigatioViewItems paired with boil-plate code-behind. This would be nice to test this. If I find some time, I will definitely look for a clean solution. :-) |
@xperiandri @MarkAllan007 apologies for the delay in getting to this - documentation on regions is in the works (hopefully this week) and I realise that the ShellView/ViewModel may be confusing. If you're using NavigationView/TabBar they should go on your MainPage, rather than the ShellView. |
Current behavior
Use Uno Wizard to setup a MVUX project which allows us to use NavigationView paired with Regions.
With minimum modifications, update the shells.xaml.cs xaml to include the markup below.
Leave most of the app.cs file the same. I removed the secondpage from the project.
A. shell.xaml file should contain two groups of markup. One group is commented out, the other is not. Uncomment and run the "NavigationView" markup. The execution reports an error: ... Region Logger is null.
B. Comment out the "NavigationView" markup and uncomment the "extended splash screen" markup. Run the "extended splash screen" markup. The Region Logger is set to a valid logger.
Expected behavior
The expected behavior for both sets of markup is that the Region Logger is properly set to a valid logger and will not throw and exception.
How to reproduce it (as minimally and precisely as possible)
Use Uno Wizard to setup a MVUX project which allows us to use NavigationView paired with Regions.
With minimum modifications, update the shells.xaml.cs xaml to include the markup below.
Leave most of the app.cs file the same. I removed the secondpage from the project.
A. shell.xaml file should contain two groups of markup. One group is commented out, the other is not. Uncomment and run the "NavigationView" markup. The execution reports an error: ... Region Logger is null.
B. Comment out the "NavigationView" markup and uncomment the "extended splash screen" markup. Run the "extended splash screen" markup. The Region Logger is set to a valid logger.
Sample markup to test with.
Workaround
I don't know of a work around.
Works on UWP/WinUI
None
Environment
No response
NuGet package version(s)
Affected platforms
No response
IDE
Visual Studio 2022
IDE version
17.8.5
Relevant plugins
Uno Platform 5.1.22.24
Anything else we need to know?
I walking through your examples. I start with using your wizard to create projects. I am testing some of Uno features the systems use of MVUX for navigation. But wanted to see how to use it with the NavigationView tools. I'm looking to see the extent use cases that allow for freestyle navigation.
Thanks so much,
Mark Allan
The text was updated successfully, but these errors were encountered: