Fantastic idea for new videos! Data binding can definitely be a little confusing at first. But seeing the pro fix common errors is infinitely helpful to say the least. Much appreciated James!
One tip from my side: VS light bulb suggestions are enabled in XAML. So if you are looking to import some namespaces in your XAML, you can just write the name of the class and press Ctrl + . (control and dot). That will suggest you to import proper namespace into your XAML directly. Very useful for providing x:DataType for the DataTemplate and DataContext.
Thank you very much James, it was super helpful. I learnt alot and noted my mistakes. I'm very new to Xamarin and all so I still run into alot of problems in my code. Yea, I was trying to send it to a database and it ran successfully. Thanks a lot!
Amazing video!!! Straight to the point and most importantly simply explained. Could you please cover the Backgrounding subject like Long-Running-Tasks for both IOs and Android.
Great tips. I'm also amazed with the capability of the auto-complete. Is that regular intellisense? Because mine does not seem to be as clever as yours. Any suggestions on configuring it?
Once again, very concise and helpful video, thanks! I learned a life-long skill from a video under 20 mins :)) I have a question about the possible React integration that is being mentioned here. Is there a good way to use React with Xamarin Forms or MAUI? I have not found any tutorials or descent-looking NuGet packages for this purpose. Do you have any pointers? Thank you
Another awesome video. I would love for you to do a video on the proper way to handle secrets for open source apps and setting those secrets during deployment to the AppStore/GooglePlay using AppCenter.
I am learning all things GitHub actions now and may do a video on that. Checkout github.com/jamesmontemagno/app-ac-islandtracker/blob/master/appcenter-post-clone.sh for secrets in app center
Hi James, I need help. Actually I have an Item Control and when I populate the same with data it comes around 50-80 item in the Grid Each Item Control has button. On click of that button I wanted to open popup but that pop-up should be inside the item control area. Could you please help me
Great video. Its clearing up a lot of little things for me. I wonder however whether implementing the NotifyPropertyChanged functionality into the (Domain) class Person is violating the Seperation of Concern principle? Shouldn´t dealing with the UI exclusively be done by the ViewModel? Or did you not regard the Person class as a Domain class? Or am I wrong at all with this thought and there is something I didn´t understand?
I think it is up to you. You may have a list of people in a ListView and then be updating their properties and want the UI to update so that would be the main way of doing it. I don't think it is an issue personally. It is still separated and if no one is listening then it doesn't hurt anyone :)
@@JamesMontemagno Hi James, thank you for the quick response. I guess you are right and it most likely depends on what you are trying to achieve. My Question arose from remembering working on a WPF project and trying to figure out where to put the functionality - into the Class or into the ViewModel. Both seemed to have pros and cons. And as always there don´t seem to be the one, "always right" answer. Thank you for the really helpful videos and I am eagerly waiting for the next one. :)
6:15 Just for a more thorough understanding of the C# language, I think it's worth noting that the error message was correct. There was no firstName *property*. A variable declaration without getters and setters is a field. Fields are not properties, and the binding system works with properties.
always waiting for your videos and always gets to learn new things. thanks james. and thank you again, for best quality practices and showing what not to do ! please tell us as well. where can we send our code.
I want to create a XAML visual component (rectangle) that will have lots of copies but with different information. Let's suppose 100 copies. I plan to use the XML Grid container to display the visual components. My question is: How can create a visual component in XAML? Can you point to possible parent classe(s)? Can I use XAML to implement the visual component? Any advice or pointers would be greatly appreciated.
Any Data Binding examples for Lists within Lists? I have a collectionview that binds to a list of "Functional Areas" (a,b,c, etc.) but within each "Functional Areas" (a,b,c, etc.) I need to display a list of buttons. The "Functional Areas" and child buttons are displayed based on user permissions.
Cool video. Can you do a video showing how to handle environment configurations in Xamarin/Maui. Include things like how to substitute in the plist and manifest, plus a recommended way to manage api calls. Been doing Xamarin for a few years and this seems to be absent from the documentation.
Awesome video James! Could you show us how to notify property of PersonViewModel when some of the Person properties is change? I mean when we change Person.Firsname from the UI to change property that is in the PersonViewModel.
The Person model implements INotifyPropertyChanged ("INPC"). This interface has a PropertyChanged event, which is raised whenever you make a change to a property. You can add an event handler in the view model to subscribe to that event: Person.PropertyChanged += (s,e) => Console.WriteLine("property on person changed");
Excellent video - really well presented and clear information! I really appreciate content where best practices are explained and coding problems solved in real-time. I do wonder about moving the INotifyPropertyChanged implementation to the model. I think it's been mentioned it in other comments but it does feel like UI concerns are leaking into the domain. With a simple example like the Person class in the video, where it's essentially just a POCO, I'm not sure it matters too much. But if the Person class were to grow more rich, encapsulating more person-y behaviour, as it would in a real application, then I think the INotifyPropertyChanged code starts to look more and more out of place. To be clear, I don't think this is an issue with your content, more something which seems to be an inherent quirk of the MVVM pattern.
Yeah, every app is different, but again think about the situation where you have a list of people and their properties are updating and you want to update the UI. INotifyPropertyChanged actually has nothing to do with the UI and is just an interface that people can subscribe to. Maybe i'll do a full video on it :)
@@JamesMontemagno I'd really appreciate a video on this! One thing that has always confused me about MVVM is how and where OnPropertyChanged() should work. I usually put it on properties in my VM, which have a backing store from a model. However, if I have a service that updates my Model, then what is the best way to push these changes to the VM? Should the model notify the VM the way the VM notifies the view?
Ok, maybe someone can help me out, I am wondering, cause I still kind of had problems telling the difference between ViewModel and Model. At the end of this example, the Person file would be the model and the PersonPageViewModel file would obviously be the ViewModel, am I right?
Hai Bro, is there any suggest from you? Sorry to ask you here, my Problem is, I want to export Xamarin.Forms Scrollview to Pdf. Please help me to reach it out. Thanks..
Here's what's confusing to me about this: in all of Jason's tutorials, he has a page and a corresponding ViewModel. For example, MainPage would correspond with MainPageViewModel. That isn't the case here -- there's a View without a ViewModel and a ViewModel without a View (MainPage has no ViewModel, PersonPageViewModel has no View). I know it's not his code, but I'm surprised he didn't address this, as it's confusing the heck out of me. I'm brand-new to everything except C# here, so I know there are assumptions concerning basic understanding that I'm missing, but... I don't know how to deal with this issue. EDIT: I didn't see he posted the code. So, yeah, that sort of solves that.
I probably wouldn’t store a password in clear text in the database is what I’m saying. I’m not a security expert but there are some best practices to follow out there.
I call it "rotting of the brain" syndrome. The field "firstname" is there, and there IS a way to get or set it, just by getting or setting it. Dude has already forgot his basics. Property is a tool to achieve some specific purpose. That purpose is to control value assignment or reading. In this case, such control is not needed, so FIELDS are OK. And if some stupid library doesn't accept fields where properties are fed, that is the problem of the library.
Yes it is totally true that you can just get and set fields. Binding generally doesn't work to fields. Most binding is based, in part, on the ComponentModel PropertyDescriptor model, which (by default) works on properties. This enables notifications, validation, etc (none of which works with fields).
Fantastic idea for new videos! Data binding can definitely be a little confusing at first. But seeing the pro fix common errors is infinitely helpful to say the least. Much appreciated James!
One tip from my side:
VS light bulb suggestions are enabled in XAML. So if you are looking to import some namespaces in your XAML, you can just write the name of the class and press Ctrl + . (control and dot). That will suggest you to import proper namespace into your XAML directly. Very useful for providing x:DataType for the DataTemplate and DataContext.
I wish that we had this video back in the day when I learned XAML the first time. Good explanation and examples for beginners!
Thanks James, a very very simple explanation that unravels the whole binding thing for those of us just starting out with xaml binding.
Hi James! You are exposing the Model to the View. You're breaking the MVVM principles. Thanks for your videos!
Maybe. As I said it is an option based on your app. I like to say you can make your own MVVM principles :)
@@JamesMontemagno haha! :) you look Groucho Marx
Thank you very much James, it was super helpful. I learnt alot and noted my mistakes. I'm very new to Xamarin and all so I still run into alot of problems in my code. Yea, I was trying to send it to a database and it ran successfully. Thanks a lot!
Yay!!!! Glad it helped out!
Definitely helpful, this is the main issue that I was having that was unclear in the Microsoft documentation.
Great video! Would like to see you do a deep dive on RelativeSource AncestorType and RelativeSource AncestorLevel.
Every day I learned something new from James ❤️
Me too.
You're awesome James, I hope your channel grows to the behemoth it deserves.
I'm just here to say how much I appreciate the pachinko machine!
Thanks James,
someone of our colleagues was asking for the same topic 2 days ago on Twitch. 👍
Nice.. we should focus more on the basics and common mistakes!
Good Job on this. Really easy explained on how it works. A lot videos go in deep explaining and losing the simpicity. Thanks :)
Amazing video!!! Straight to the point and most importantly simply explained. Could you please cover the Backgrounding subject like Long-Running-Tasks for both IOs and Android.
How do you data-bind/notifypropertychanged if there is a list inside the person model
Great tips.
I'm also amazed with the capability of the auto-complete. Is that regular intellisense? Because mine does not seem to be as clever as yours. Any suggestions on configuring it?
Just regular Visual Studio 2022 community edition:) nothing else
@@JamesMontemagno Then I guess I should start using 2022, instead of 2019 :)
Muito interessante, aprendo "English" e programação ao mesmo tempo. I'm from Brasil.
Goldmine Channel. Subbed.
Excellent explanation👍
Once again, very concise and helpful video, thanks! I learned a life-long skill from a video under 20 mins :))
I have a question about the possible React integration that is being mentioned here. Is there a good way to use React with Xamarin Forms or MAUI? I have not found any tutorials or descent-looking NuGet packages for this purpose. Do you have any pointers? Thank you
Another awesome video. I would love for you to do a video on the proper way to handle secrets for open source apps and setting those secrets during deployment to the AppStore/GooglePlay using AppCenter.
I am learning all things GitHub actions now and may do a video on that. Checkout github.com/jamesmontemagno/app-ac-islandtracker/blob/master/appcenter-post-clone.sh for secrets in app center
Hi James,
I need help.
Actually I have an Item Control and when I populate the same with data it comes around 50-80 item in the Grid Each Item Control has button. On click of that button I wanted to open popup but that pop-up should be inside the item control area.
Could you please help me
Can this work for a collection of objects that have internal properties?
Oof. I always put logic in getters/setters to update UI stuff.
Not sure if I will use this method from now on - but now I know of it and it is awesome
Great video. Its clearing up a lot of little things for me. I wonder however whether implementing the NotifyPropertyChanged functionality into the (Domain) class Person is violating the Seperation of Concern principle? Shouldn´t dealing with the UI exclusively be done by the ViewModel? Or did you not regard the Person class as a Domain class? Or am I wrong at all with this thought and there is something I didn´t understand?
I think it is up to you. You may have a list of people in a ListView and then be updating their properties and want the UI to update so that would be the main way of doing it. I don't think it is an issue personally. It is still separated and if no one is listening then it doesn't hurt anyone :)
@@JamesMontemagno Hi James, thank you for the quick response. I guess you are right and it most likely depends on what you are trying to achieve. My Question arose from remembering working on a WPF project and trying to figure out where to put the functionality - into the Class or into the ViewModel. Both seemed to have pros and cons. And as always there don´t seem to be the one, "always right" answer. Thank you for the really helpful videos and I am eagerly waiting for the next one. :)
Love It James.
6:15 Just for a more thorough understanding of the C# language, I think it's worth noting that the error message was correct. There was no firstName *property*. A variable declaration without getters and setters is a field. Fields are not properties, and the binding system works with properties.
always waiting for your videos and always gets to learn new things. thanks james. and thank you again, for best quality practices and showing what not to do !
please tell us as well. where can we send our code.
Great video... super helpful
I want to create a XAML visual component (rectangle) that will have lots of copies but with different information. Let's suppose 100 copies. I plan to use the XML Grid container to display the visual components. My question is: How can create a visual component in XAML? Can you point to possible parent classe(s)? Can I use XAML to implement the visual component? Any advice or pointers would be greatly appreciated.
Any Data Binding examples for Lists within Lists? I have a collectionview that binds to a list of "Functional Areas" (a,b,c, etc.) but within each "Functional Areas" (a,b,c, etc.) I need to display a list of buttons. The "Functional Areas" and child buttons are displayed based on user permissions.
Great video, i just learned something new !
Really good idea.
I am loving it ❤
Cool video. Can you do a video showing how to handle environment configurations in Xamarin/Maui. Include things like how to substitute in the plist and manifest, plus a recommended way to manage api calls. Been doing Xamarin for a few years and this seems to be absent from the documentation.
Awesome video James! Could you show us how to notify property of PersonViewModel when some of the Person properties is change? I mean when we change Person.Firsname from the UI to change property that is in the PersonViewModel.
The Person model implements INotifyPropertyChanged ("INPC"). This interface has a PropertyChanged event, which is raised whenever you make a change to a property.
You can add an event handler in the view model to subscribe to that event:
Person.PropertyChanged += (s,e) => Console.WriteLine("property on person changed");
Is there a situation where we need to notify property changed for static properties ? ! if yes why does it not work with OnPropertyChanged?
Excellent video - really well presented and clear information! I really appreciate content where best practices are explained and coding problems solved in real-time.
I do wonder about moving the INotifyPropertyChanged implementation to the model. I think it's been mentioned it in other comments but it does feel like UI concerns are leaking into the domain. With a simple example like the Person class in the video, where it's essentially just a POCO, I'm not sure it matters too much. But if the Person class were to grow more rich, encapsulating more person-y behaviour, as it would in a real application, then I think the INotifyPropertyChanged code starts to look more and more out of place. To be clear, I don't think this is an issue with your content, more something which seems to be an inherent quirk of the MVVM pattern.
Yeah, every app is different, but again think about the situation where you have a list of people and their properties are updating and you want to update the UI. INotifyPropertyChanged actually has nothing to do with the UI and is just an interface that people can subscribe to. Maybe i'll do a full video on it :)
@@JamesMontemagno beginers here. stuck on this problem too, hope you do a full video 🥲
@@JamesMontemagno I'd really appreciate a video on this! One thing that has always confused me about MVVM is how and where OnPropertyChanged() should work. I usually put it on properties in my VM, which have a backing store from a model. However, if I have a service that updates my Model, then what is the best way to push these changes to the VM? Should the model notify the VM the way the VM notifies the view?
Any examples on how to pass data between views? Like Lists, Single Objects etc....
Why did you write get => password instead of get { return password} in the additional optimization part?
Just more modern syntax, newer C# features
@@JamesMontemagno thank you.
Great video, but I wonder wouldn’t INotifyPropertyChanged cause an error if the object is used in EF as Database?
Shouldn’t it is a copy out of the database, you would want to save it if it was changed
Good video, thanks!
Ok, maybe someone can help me out, I am wondering, cause I still kind of had problems telling the difference between ViewModel and Model. At the end of this example, the Person file would be the model and the PersonPageViewModel file would obviously be the ViewModel, am I right?
Thank you
Super amazing
Hai Bro, is there any suggest from you?
Sorry to ask you here, my Problem is, I want to export Xamarin.Forms Scrollview to Pdf.
Please help me to reach it out.
Thanks..
Do you mean you are trying to display a Pdf?
I have done this in WPF you first convert it to XPSand then to PDF its quite a headache but it can happen
Good basic video.
Here's what's confusing to me about this: in all of Jason's tutorials, he has a page and a corresponding ViewModel. For example, MainPage would correspond with MainPageViewModel. That isn't the case here -- there's a View without a ViewModel and a ViewModel without a View (MainPage has no ViewModel, PersonPageViewModel has no View).
I know it's not his code, but I'm surprised he didn't address this, as it's confusing the heck out of me. I'm brand-new to everything except C# here, so I know there are assumptions concerning basic understanding that I'm missing, but... I don't know how to deal with this issue.
EDIT: I didn't see he posted the code. So, yeah, that sort of solves that.
Hello James , Need about the unit test in .NET MAUI .
nUinit, xUnit, and of the standard unit testing stuff would work. Checkout what the team uses github.com/dotnet/maui/tree/main/src/Core/tests
Please make a video of Xamarin bluetooth connection tutorial, Thank you.
Will try
@@JamesMontemagno, Thank you very much 😃
[CallerMemberName] is quite nice instead of declaring every name...
Checkout my MVVM helpers that really simplifies all of this stuff ua-cam.com/video/y8ZqEOLDeo8/v-deo.html
yup, without a get/set its not a property but a field!
Please create a binding advanced video, thanks
What specifics would you like to see?
good
Xaml can't bind unless default constructor in vm. That's.oftem left out of these binding tutorials. These are not real world examples.
captions could use a review
Observerpattern
Never keep a password with a person. Why? A password isn't an attribute of the person.
I probably wouldn’t store a password in clear text in the database is what I’m saying. I’m not a security expert but there are some best practices to follow out there.
@@JamesMontemagno So my remark is a perfect for these best practices.
you must have BindableBase¡¡¡
In MVVMHelpers I do. checkout my other videos on it.
I call it "rotting of the brain" syndrome. The field "firstname" is there, and there IS a way to get or set it, just by getting or setting it. Dude has already forgot his basics. Property is a tool to achieve some specific purpose. That purpose is to control value assignment or reading. In this case, such control is not needed, so FIELDS are OK. And if some stupid library doesn't accept fields where properties are fed, that is the problem of the library.
Yes it is totally true that you can just get and set fields. Binding generally doesn't work to fields. Most binding is based, in part, on the ComponentModel PropertyDescriptor model, which (by default) works on properties. This enables notifications, validation, etc (none of which works with fields).
Any examples on how to pass data between views? Like Lists, Single Objects ???