Navigation with .NET MAUI Shell - .NET MAUI Tutorial Step-by-Step

  Рет қаралды 29,096

Gerald Versluis

Gerald Versluis

Күн бұрын

Пікірлер: 84
@jfversluis
@jfversluis 2 жыл бұрын
💡Looking for the next part in this course? Click here to find it, you will learn in this video how to leverage platform features with .NET MAUI: kzbin.info/www/bejne/m4O7mpyvbZVjjrs Want to review the full playlist? You can do that here 👉kzbin.info/www/bejne/o5i6Z6usns6lh80
@Mielesplayz
@Mielesplayz 2 жыл бұрын
You forgot to pin the comment
@jfversluis
@jfversluis 2 жыл бұрын
@@Mielesplayz Thanks!
@Mielesplayz
@Mielesplayz 2 жыл бұрын
@@jfversluis No problem
@MrBigdogtim69
@MrBigdogtim69 2 жыл бұрын
Another good video. I like that the example project is passing a Dictionary object - I know I field a lot of questions on URI navigation with parameters. The most common scenario I see is a List/Collection view tap to a detail page where the List/Collection view has business objects (e.g. contacts). Even when they have the entire contact object/record in the ObservableCollection in the main page, they pass an index or key and look up the contact again - so showing a concrete example of a complex object being passed is a good "pro tip". The series is coming along nicely!
@jfversluis
@jfversluis 2 жыл бұрын
Hoping to continue on this path! That is exactly what it's about, showing off the basics in a real sample that is coming together. Glad you think it's helpful. Now the pressure it on to keep it up...
@rikudouensof
@rikudouensof 2 жыл бұрын
Great explaining the necessary data. transfer from page one to page 2
@jfversluis
@jfversluis 2 жыл бұрын
Glad you like it, thanks!
@davidjackson148
@davidjackson148 2 жыл бұрын
From all the examples I can find around MAUI Shell, there is not a single one that shows Flyout on any other page other than the first page. It seems like it's always assumed you want your app to start with the Flyout navigation and I don't. My app has a couple of pages to get through before you get the the Flyout page. How do I do that please. Can you do a video?
@garyhengeveld4452
@garyhengeveld4452 Жыл бұрын
How can I navigate back to the "MainPage"? Shell.Current.GoToAsync("MainPage") just give an unknown error.
@jonathanbushby966
@jonathanbushby966 Жыл бұрын
That’s what I was wondering. No back button, where is it?
@leosouza1520
@leosouza1520 Жыл бұрын
Very good explanation of how to pass complex objects as shell navigation parameters.
@jfversluis
@jfversluis Жыл бұрын
Thanks!
@davidjackson148
@davidjackson148 2 жыл бұрын
I'm lost. I can't see the relationship between the Dictionary passed in and how you get that in the view. Seems kinda random. I want do send one or more models to my new page, some with page data and others with security data. How do I do that. Is this the only way to do this? Do I have to have a page ViewModel? My app is becoming cluttered with ViewModels and all I want is to get at the data passed.
@Danilo-zr7bz
@Danilo-zr7bz 3 ай бұрын
Thank you! It really helped me.
@rasmusb639
@rasmusb639 2 жыл бұрын
Could you do one on maps in MAUI? With custom markers and perhaps styling - it's the one thing keeping me from migrating from Xamarin to MAUI
@jfversluis
@jfversluis 2 жыл бұрын
The official maps support will come in .NET 7 so I will wait a little bit longer for that one!
@25kyro
@25kyro 2 жыл бұрын
When I tried shell routing in Xamarin , my iOS version was glitchy on the bad navigation. Whenever I navigated back to the page , it would have an empty view. Is this fixed in Maui or was this an error on my part?
@duncancole1742
@duncancole1742 2 жыл бұрын
I've done a few production apps using Shell and never encountered an issue like you've described (there certainly have been issues with navigation though, particularly with routing) so I reckon keep digging into the problem and you'll get to the bottom of it :)
@acc6540
@acc6540 9 ай бұрын
Hi Gerald, I hope you are well Thanks for the tutorials Gerald, can two shell pages be used in one App?
@madsvering7383
@madsvering7383 6 ай бұрын
Regarding passing object upon navigation. I need to pass an exception. I put this into Dictionary, but seems like the Shell navigation requires the object to implement the IConvertible interface: System.InvalidCastException: Object must implement IConvertible. Can Shell "navigation parameters" in the form of a Dictionary be used here, or will I need to figure out another place to store the exception while navigating, or will I need to refactor the code?
@valgardg48
@valgardg48 2 жыл бұрын
navigation and passing data itself works great, but i am having an issue with updating the data displayed on the details page. When I update the observable property, no changes are applied in the ui. Any idea what the problem could be? Everything is done according to the previous videos
@shahanahmed9444
@shahanahmed9444 2 жыл бұрын
Lets say you are making a social media application like facebook, for example. How do you prevent opening a duplicate page? lets say I have a users profile page already open in the stack, how do I prevent opening the same user profile page which will cause the stack to have 2 of the same pages. I hope you get what i am trying to say.
@tanakamawere
@tanakamawere 2 жыл бұрын
Hie gerald. I feel like you rushed past somewhere on the Gesture Recogniser part with MVVM. I am trying to follow the docs but there are a couple of problems. 1. x:DataType which links to my model does not define the Command in the viewmodel. So I can't run them both together. 2. Parsing the tapped item through to the ViewModel. I suppose that is what CommandParameter is for but I am failing to implement it
@kratos7ism
@kratos7ism 2 жыл бұрын
i have the exact same problem . Did you find a workaround ?
@nicolarigoni1062
@nicolarigoni1062 Жыл бұрын
Great example, but if I son't use shell how and for example I start with a NavigationPage in the App.xaml how in the best way to pass data to another page called in a navigation or maybe to another page that is a modal? always thought MVVM and dependency injection pattern? Thanks
@prerns
@prerns 11 ай бұрын
HI Gerald, Thanks for the amazing videos. Could you make one video for creating a flyout menu goign from a login screen please. Had Tried using Flyout Page and was running into issues. Then tried using Shell F;youtItem which works but I need a custom Flyout Menu Page.
@duncancole1742
@duncancole1742 2 жыл бұрын
On the topic of Navigation and Routing: I had a particularly annoying issue with iOS navigation if my UI had an overflow 'More' tab on the bottom navigation. iOS it seems, creates it's own intermediary 'more' controller to host the various more options which Xamarin Shell seemingly didn't have any idea about so you could not use routes (e.g.//more/somepage) to get to any of the pages in the overflow. It worked fine in Android because Android just creates a little context menu instead so all the overflow tabs where at the same top level (e.g. you could navigate to one with just a //somepage route). My fix was to just explicitly create a More tab myself that had links to all the overflow tabs which meant that a route of //more/somepage would work. Was a bit of busy work and it would be good to know if MAUI has fixed this problem. Also, will the standard Login flow be better supported in MAUI Shell? The way I've been doing it when I have an app that requires the user to sign in first is to hook into the StartUp class and get it to go to the login page instead of "await Shell.Current.GoToAsync("//main");" if they are not authenticated. It just seemed like a bit of a janky way to do it so maybe there's a better way already.
@trendytrailer2746
@trendytrailer2746 5 ай бұрын
How to find the that navigation is happening for the backward in codebehind of any page in appshell.
@mugileeshwaranj.s8484
@mugileeshwaranj.s8484 5 ай бұрын
How to handle navigation in non UI classes, i have to use navigation inside the class which is inside andriod folder..
@zikkrype
@zikkrype Жыл бұрын
I'm getting errors: "relative routing to shell elements is currently not supported" or "Global routes currently can't be the only page on the navigation stack" when I try programatically navigate from viewmodels
@Pukoization
@Pukoization 2 жыл бұрын
Hello Gerald. Great explanation again. I have one question regarding registration of pages. In your video, you are registering all pages as transient. Is this a good way ? Maybe it would be better to register it as singleton and somewhere in navigation change the bindingcontext of the page. Not sure if this is possible but it may improve performance because the page was already rendered and you just need to set a new bindingcontext to change the UI. What do you think ?
@AwesomeRob77
@AwesomeRob77 2 жыл бұрын
Great video, but I have a question. I opened the MonkeyFinder SLN for Part 3 - Navigation and it runs fine making the service calls as a Windows app. However, running on an Android simulation it does not display the data. I can step through the code and see the data being returned from the service (13 monkeys), but it never displays like in the Windows version and the beginning of this video. Suggestions?
@michaelrogers6935
@michaelrogers6935 Жыл бұрын
I gather you can handle the tap either in code-behind or as a command in the view model. Why (at the 6:40 or so mark) did you choose the former? Great video, btw. Next time I teach software engineering I am going to make this entire series required viewing. Another question: does it matter if you typecast the sender to be a ViewElement or Frame?
@jfversluis
@jfversluis Жыл бұрын
In this instance I chose the event simply because that is a bit easier to explain. The navigation is already present in the page. Else, at that point, I would need to go explain about how to get the navigation inside of your view model, hook up a command and then call that command inside your page. Which technically if you want to do it "right" (if that's a thing to begin with) is what you should do, but it's always hard to find a balance in these videos between overwhelming someone and just teaching the core concepts. > does it matter if you typecast the sender to be a ViewElement or Frame? Not really, both are in the same inheritance tree. If you need properties specific to a Frame, cast it to that, if you don't cast it to the other. Thank you so much for the kind words, appreciate it! Glad you're enjoying the videos!
@agentgreen521
@agentgreen521 2 жыл бұрын
Hi Gerald! Another great video. I have a question. How about the navigation going back to login page? I have injected the vm for loginpage but when i'm trying to do the mainpage navigation for login pagei need to inherit the vm again. Is there any simple way to do this. I'm new to this kind of dependency injection. Thanks!
@rollycervantes4702
@rollycervantes4702 2 жыл бұрын
Hello Gerald. Great videos and explanations. I have a small question. What do you think is the best way to load the data instantly without the use of the button "Get Monkeys"?
@Golden_games
@Golden_games Жыл бұрын
put the get monkey code in the constructor of the page
@janne_kekalainen
@janne_kekalainen 2 жыл бұрын
Just FUI for people on Windows running dark system theme. The details page appears broken due to the dark theme background color defined in App.xaml being damn near the label text color. So the page appears to not load the labels, but it does, they are just defacto invisible.
@r.gopalakrishnan6926
@r.gopalakrishnan6926 2 жыл бұрын
Interesting...💫
@jfversluis
@jfversluis 2 жыл бұрын
Thank you!
@PierreH1968
@PierreH1968 2 жыл бұрын
Thanks!
@jfversluis
@jfversluis 2 жыл бұрын
You’re very welcome Pierre!
@TheErudito
@TheErudito Жыл бұрын
Nice shirt
@jfversluis
@jfversluis Жыл бұрын
Thank you!
@myMovieManager
@myMovieManager Жыл бұрын
Hey Gerald! Potential bug. Passing an object to a new page, in the VM the observable property value is null until the page is loaded. You are unable to access passed values of an object in the VM constructor. Very annoying if your wanting to load some data from a WS
@jfversluis
@jfversluis Жыл бұрын
If you really think something might be up check the repo of it’s already reported or, if not, open something yourself!
@shahanahmed9444
@shahanahmed9444 Жыл бұрын
I have a login page which is a navigation page. After the use has logged in successfully how do I open a shell page where remaining navigations will happen in the shell?
@FortyTwoAnswerToEverything
@FortyTwoAnswerToEverything Жыл бұрын
Do you know why the Windows app doesn't live update on changes but the android emulator does?
@jfversluis
@jfversluis Жыл бұрын
Hm no, Windows app should do that as well!
@tarktaro3861
@tarktaro3861 2 жыл бұрын
Awesome
@jfversluis
@jfversluis 2 жыл бұрын
Thanks!
@tasher7882
@tasher7882 2 жыл бұрын
Loved the vid. fallowed it to a T and it works on Windows, but not on Android. I am using the Samsung SM-T580 android 8.1 - api27. And it comes up with the page. When I click on the command button it hits the command gets the monkeys and puts the in the collection. But the view doesn't show anything. Kind of scratching my head. Any ideas?
@jfversluis
@jfversluis 2 жыл бұрын
Hm might be a but that is going on on Android right now
@michaelrogers6935
@michaelrogers6935 Жыл бұрын
One more question -- can someone tell me if this summary is correct, or if not, what needs to be done to make it correct? When navigating to a page, if there are queries, the system looks to see if the page has a view model, and if that view model is IQueryAttributable. If so, it fires up that view model's ApplyQueryAttributes method.
@jfversluis
@jfversluis Жыл бұрын
Not sure if I understand you correctly... The way it works is, while navigating you can pass in any object, simple or complex, and that will be provided to the page you're navigating to. The object you're passing is given a unique key. By adding the QueryProperty attribute on the receiving page (or view model, it really doesn't actually matter) you can specify the key you set from the origin (where the navigation is triggered) and the property in the receiving object. There is no strong connection between the origin of the navigation and the receiving (the view model in this case) as far as I know. By applying that QueryProperty attribute it will probably register to receive any navigation collection with that specified key. Then it's up to you to connect the view model with the view through setting the BindingContext. Hope this helps!
@michaelrogers6935
@michaelrogers6935 Жыл бұрын
@@jfversluis Thanks for this (and all the other answers!) I wasn't sure how the query -- which I thought was destined for the page being navigated to -- made its way to the view model instead, and was trying to postulate the mechanism. But I guess all I really need to know is that the query goes to either, if they have the QueryProperty attribute I am curious how the system can identify a page's view model -- because there isn't a ViewModel class being extended. Is it any object passed to a page's constructor that is an INotifyPropertyChanged, and that someone the dependency injection magic is sorting this out?
@markiiankhylynsyi2039
@markiiankhylynsyi2039 Жыл бұрын
What native android control does shell use for the NavBar?
@jfversluis
@jfversluis Жыл бұрын
The regular AppCompat ActionBar
@davidjackson148
@davidjackson148 2 жыл бұрын
Is the only way to pass objects using view models? I just want to pass the object and have the page work out what to do with it without having to create another view model. so how can my new page get the object passed in without having to use the viewmovel ? or is this not possible
@jfversluis
@jfversluis 2 жыл бұрын
A view model is just another object. If you can pass a view model you can pass any other object as well :)
@davidjackson148
@davidjackson148 2 жыл бұрын
@@jfversluis That's the problem. I can't even pass that, I can find no way for the receiving page to get at the object passed to it. All the examples I've seen do the same as you. I can't seem to pass dependency objects and dictionary objects at the same time. The passed object is always null
@serique1323
@serique1323 Жыл бұрын
@@davidjackson148 make one more class init, like public MyClass(SomeClass obj) { InitialiseComponent(); BindingContect = MyVM(obj);} also you need to make changes to VM
@madsvering7383
@madsvering7383 6 ай бұрын
Hi Gerald, what if I don't want monkey to be an observable property? Search for just "Property", but no luck.
@jfversluis
@jfversluis 6 ай бұрын
Sorry I'm not 100% sure what you mean?
@madsvering7383
@madsvering7383 6 ай бұрын
The Monkey variable “monkey” is annotated with ObservableProperty. I tried without that annotation, but seems like the toolkit uses it to tie things together. However, I do not need it as an observable property, just as a normal property/variable that I can use in business logic. Thx.
@jfversluis
@jfversluis 6 ай бұрын
@@madsvering7383 the observable attribute is there so it will update the ui automatically when there are changes in the data. If you don’t need that, just take it off and use the object as normal
@madsvering7383
@madsvering7383 6 ай бұрын
@@jfversluis thanks a lot for your reply and great videos. However, removing the [ObservableProperty] annotation seems to break the auto-assignment of the monkey variable done by the toolkit. I still need to transfer the monkey from view a to view b, but in my case I do not show it on the UI (so no need for the ObservableProperty), I use it in business logic. So to me it seems that [QueryProperty] annotation on the class only works woth fields that have the [ObservableProperty] annotation. Is that correct? Of course I could just use the ObservableProperty but seems like the wrong way of doing it in my case.
@madsvering7383
@madsvering7383 6 ай бұрын
Hi, Sorry @jfversluis my incorrect conclusion above was due to the fact, that I did not have a public property when I tested, just a private field. With a public property it works as you say, without the ObservableProperty annotation. That public property is auto-generated by the community toolkit, when using the ObservableProperty. Thanks.
@resler7ooo118
@resler7ooo118 2 жыл бұрын
Great s
@jfversluis
@jfversluis 2 жыл бұрын
Thank you!
@ricardofernanddes4218
@ricardofernanddes4218 Жыл бұрын
how can in open a instagram profile with a instragram icon in my menu? help-me please
@jfversluis
@jfversluis Жыл бұрын
Sorry, not sure what you mean!
@ManderO9
@ManderO9 2 жыл бұрын
bro so many monkeys, idk which is which
@jfversluis
@jfversluis 2 жыл бұрын
🐵🙈🙉🙊
@jfversluis
@jfversluis 2 жыл бұрын
🐵🙈🙉🙊
@kainafa
@kainafa 2 жыл бұрын
Awesome 🚀
@jfversluis
@jfversluis 2 жыл бұрын
Glad you like it! Thanks!
@leonedev
@leonedev 7 ай бұрын
Shell.TabBarBackgroundColor actualy is broken, if you set i to transparent it will instead put a #f7f7f8. If you have suggestion on how to fix this, would be great.......
@jfversluis
@jfversluis 7 ай бұрын
Please check the issues on the repo. I'm not familiar with a bug like this!
@leonedev
@leonedev 7 ай бұрын
@@jfversluis already checked but issues are never addressed/solved, difficult to use maui with these bugs, also there is a bug with the shell navigation when using tabbar while nesting child ShellContent but without some properties on it, i mean...and it's after .net 8 release. I'm pointing this out just because I see that you deliver good content on Xamarin and MAUI and maybe you are involved with it. In any case keep up the good work!
@jfversluis
@jfversluis 7 ай бұрын
@@leonedev I am working on the .NET MAUI team so yes I'm involved ;) we're constantly evaluating our priorities and unfortunately these didn't seem to have made it to the top of the list yet. If you can give me some issue numbers I can have a look
Platform Features and Device Sensors - .NET MAUI Tutorial Step-by-Step
27:11
The CUTEST flower girl on YouTube (2019-2024)
00:10
Hungry FAM
Рет қаралды 51 МЛН
Modus males sekolah
00:14
fitrop
Рет қаралды 25 МЛН
Players vs Corner Flags 🤯
00:28
LE FOOT EN VIDÉO
Рет қаралды 35 МЛН
Magic or …? 😱 reveal video on profile 🫢
00:14
Andrey Grechka
Рет қаралды 86 МЛН
Highly Customizable Popups for .NET MAUI with Mopups
18:20
Gerald Versluis
Рет қаралды 31 М.
.NET MAUI's Navigation for Beginners - Push, Pop, & Pass Objects
21:36
James Montemagno
Рет қаралды 66 М.
🐚 Shell for .NET MAUI & Xamarin.Forms - What, why, and how?!?!
16:51
James Montemagno
Рет қаралды 36 М.
Shell Navigation With Parameter and Dependency Injection In .NET MAUI
34:32
Programming With Pragnesh
Рет қаралды 9 М.
Learn Blazor: Build an Inventory Management System in .NET 8
2:17:34
Starting .NET MAUI Development in 2024 - What You Need To Know
35:18
James Montemagno
Рет қаралды 69 М.
Start Your New .NET MAUI App with These Amazing Templates!
15:06
Gerald Versluis
Рет қаралды 25 М.
Advanced C# - LINQ Tutorial
3:07:24
freeCodeCamp.org
Рет қаралды 122 М.
The CUTEST flower girl on YouTube (2019-2024)
00:10
Hungry FAM
Рет қаралды 51 МЛН