MVVM for Beginners: Model-View-ViewModel Architecture for Xamarin.Forms, .NET MAUI, WPF, UWP, & More

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ส.ค. 2024
  • It is go time! Time for some architecture with MVVM, data binding, commanding, and more. In this episode I walk you through everything you need to know about MVVM, what it is, why you need it, and how it can help you be more productive and write less code that is more testable.
    I break down MVVM with Xamarin.Forms, however most of the concepts are the same across WPF & UWP. Some key differences are that you have DataContext instead of BindingContext (WPF/UWP) and x:Bind instead of x:DataType - docs.microsoft.com/windows/uw... on UWP for compiled bindings (nothing available for WPF).
    Full Xamarin Beginner's Playlist - • Xamarin & Xamarin.Form...
    👕 Buy some swag! - jamesmontemagno.myspreadshop....
    Time Codes:
    00:00 - Introduction
    01:30 - What is MVVM?
    05:30 - Using Data Binding and INotifyPropertyChanged
    14:10 - What is ICommand
    17:30 - Using Commands, not Click Handlers
    20:30 - Our First View Model
    25:00 - Wrap-up
    Disclaimer: This channel, videos, and streams are created in my spare time and are a product of me... James Montemagno! They are NOT officially affiliated or endorsed by Microsoft (my employer) in any way. Opinions and views are my own.
    Links:
    * XAML: docs.microsoft.com/xamarin/xa...
    * Data Binding: docs.microsoft.com/xamarin/xa...
    * Source Code: github.com/jamesmontemagno/my...
    What is on my hat? It is the CLE clothing logo because I am from Cleveland! Checkout their awesome CLE merch: cleclothingco.myshopify.com/
    What is that art on my wall? It is an original piece from the French street artist Gregos of La Butte Montmartre: / bcez1onhiqx
    Follow:
    👨‍💻 GitHub: github.com/jamesmontemagno
    🦜 Twitter: / jamesmontemagno
    🔴 Twitch: / jamesmontemagno
    📄 Website: www.montemagno.com
    📰 Newsletter: newsletter.montemagno.com/
    My Setup:
    * Blue Spark Microphone - amzn.to/3qgtYkq
    * Blue Pop Filter - amzn.to/3jEWM3r
    * Rode Microphone Arm - amzn.to/2Z68AlE
    * Sony MDR7306 Headphones - amzn.to/372jxta
    * Stream Deck - amzn.to/373Uk1n
    * Elgato Cam Link - amzn.to/3a9eGbh
    * GoPro Hero - amzn.to/374lm90
    * MX Master 2S Mouse - amzn.to/3d7J2gj
    * Tecware Phantom Keyboard - amzn.to/3aUP4y9
    #MVVM #Xamarin #XamarinForms #XAML
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 186

  • @omarsebakhi
    @omarsebakhi 2 ปีที่แล้ว +6

    OMG!!! I couldn't believe that one day I would understand MVVM, I was so disappointed until I saw this video. What is that easy?!!! Now, MVVM is not magic, you are the magician in explaining things!!!

  • @marcioviana7352
    @marcioviana7352 2 ปีที่แล้ว +2

    Thanks James. I'm just start learning Xamarin and I really think your tutorials are being very very helpful for me to learn good practices on writing code.

  • @danhayworth6338
    @danhayworth6338 3 ปีที่แล้ว +4

    Man, you are the best in youtube tutorials! Just putting it out there.

  • @maso4u
    @maso4u 3 ปีที่แล้ว +2

    I'm a quarter through watching this video and already there is so much understanding that I've gained on the MVVM architecture I feel confident in using it with my applications/projects

  • @kopilkaiser8991
    @kopilkaiser8991 ปีที่แล้ว

    Absolutely great tutorial to introduce yourself properly to ViewModel. I really was facing issue understanding it from looking at different sources but you've made it possible to understand the topic easily.

  • @khalednabilcs
    @khalednabilcs 3 ปีที่แล้ว +2

    WOW, I am amazed by the content of your videos!!
    Thanks James!

  • @Mikosha97
    @Mikosha97 2 ปีที่แล้ว +1

    I was terrified of all this stuff, now I think it's possible to understand and use! Thank you so much!!

  • @slimbenromdhane436
    @slimbenromdhane436 2 ปีที่แล้ว +2

    This video is awesome, I know I'm not there yet and I have to rewind this video few times to really understand this architecture but this was very informative.
    Thank u.

  • @MrFrawsty
    @MrFrawsty 2 ปีที่แล้ว +2

    Bro I love your teaching style and explanations for everything. Thank you for these videos!

  • @iamashyura
    @iamashyura 2 ปีที่แล้ว +2

    What can I say? ONLY WOW!!! This is really helpful!! Everything is now clear for my understanding. Thank you for all your videos. This is how i like it. Explanation and how to do it.👍👍👍👍👍

  • @srikanthl9399
    @srikanthl9399 3 ปีที่แล้ว +2

    Very useful the most craving subject for xamarin developer, Please keep the great work.

  • @ryanrobbins4391
    @ryanrobbins4391 2 ปีที่แล้ว +13

    You have by far explained MVVM the best out of everyone I have watched...and I have watched hours of people trying to explain it. Don't stop making videos!

    • @JamesMontemagno
      @JamesMontemagno  2 ปีที่แล้ว +1

      Thanks so much! Glad that you found it helpful

  • @mayanmaster92
    @mayanmaster92 3 ปีที่แล้ว +1

    Good lord thank you for this. I've been looking how to actually start an mvvm project and now I feel like I can actually do it. Thank you!

  • @ethansue6341
    @ethansue6341 2 ปีที่แล้ว +2

    Your tutorials are amazing! Learning xamarin through your videos for a personal project and its amazing how useful and informative your videos are!

  • @samcamphyn1950
    @samcamphyn1950 3 ปีที่แล้ว +1

    I love your video's, all of them are explained in a clear and unambiguous manner. Thanks!

  • @maheshkumbhar4216
    @maheshkumbhar4216 3 ปีที่แล้ว +1

    Thank you James
    Clearly understand What is Binding , Command , View model, Binding Context , flow of get set.

  • @sunnychahal1237
    @sunnychahal1237 ปีที่แล้ว

    After falling asleep through countless videos finallt a video i could get through, thanks for sharing this in the way that you did

  • @kardo205
    @kardo205 2 ปีที่แล้ว

    Thank You!!!!!!
    In 30 minutes you clarified all the doubts and complications that existed in my brain about Binding and MVVM! Thank you very much

  • @joshuamanalo8323
    @joshuamanalo8323 3 ปีที่แล้ว

    Hi, I am starting to learn Xamarin Forms, and this video series helped me a lot! So I want to thank you and please keep it up!

  • @user-sv3fz3pg4z
    @user-sv3fz3pg4z ปีที่แล้ว

    Awesome! Efficient and straight to the point!

  • @tienpham-pc3lb
    @tienpham-pc3lb 2 ปีที่แล้ว +1

    Thank you James, you make the topic much more interesting.

  • @baranikumars8952
    @baranikumars8952 2 ปีที่แล้ว

    You are the best .Net teacher in the whole world, wonderful tutorials😍

  • @--Eric--
    @--Eric-- 3 ปีที่แล้ว +7

    Amazing, less than 30 min, ought to be the #1 of MVVM videos. Thanks, James.

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      Wow, thanks! Glad that it helped so much :)

    • @parko1965
      @parko1965 2 ปีที่แล้ว +1

      I'll second that.

  • @gendir9827
    @gendir9827 2 ปีที่แล้ว

    Yes...Great...This is really the video which really TEACHES the MVVM, not thirdparty helpers ,classes, frameworks,etc... This is really the tutorial for the MVVM Architecture in Logical Concept...Thanks...was very informative and effective video... !!

  • @taiwantoklip
    @taiwantoklip 2 ปีที่แล้ว +2

    Dear James,your lecture really healed my MVVM-phobia
    Thank you.

    • @omarsebakhi
      @omarsebakhi 2 ปีที่แล้ว +1

      Oh my God! Same thing!

  • @alessandroaggio
    @alessandroaggio ปีที่แล้ว

    This video is GOLD!!!! Thank you man!!! BIG THUMBS UP!!

  • @hackertitan
    @hackertitan 2 ปีที่แล้ว

    Awesome videos man. I learn a lot of new things. Thanks and keep on making these videos.

  • @rikudouensof
    @rikudouensof 2 ปีที่แล้ว +1

    Thanks for the basics again, been over a year

  • @Emrys_Gough
    @Emrys_Gough 2 ปีที่แล้ว +4

    Dang man. These videos are awesome. I'm trying to build my own app that I was to eventually publish, but I have a lot to learn and to do before it gets there. These videos are incredibly helpful. Thank you.

    • @nohopestage
      @nohopestage 2 ปีที่แล้ว

      Hey, how's the progress? I'm in the same position right now

    • @Emrys_Gough
      @Emrys_Gough 2 ปีที่แล้ว +1

      @@nohopestage I've shelved my project for the time being. Someone else with more financial backing and more manpower already had my idea and built an app for it. That's my situation though. Don't let my experience stop your progress.

  • @zx-xn1lb
    @zx-xn1lb 3 ปีที่แล้ว +1

    mvvm so coooool!Thanks James.Really helped.

  • @gelbermahecha7272
    @gelbermahecha7272 3 ปีที่แล้ว

    Nice explanation. Thanks James

  • @stefanbogdanovic590
    @stefanbogdanovic590 3 ปีที่แล้ว

    Amazing video! I am really interested in learning Xamarin right now. Thank you for amazing explanation.

  • @disalfa
    @disalfa 3 ปีที่แล้ว +77

    I started learning Xamarin about 3 months ago. Self taught and with a huge thirst to learn (although i am 44 with family and tiiny amount of time for me). After wandering around from tutorial to tutorial i saw your videos! WOW! You make it look so simple that anyone can understand it.
    Like you usually say "Boom ...magic happens". You are a person who loves what he does and that's why you do it so right. Keep on educating and inspiring the world MJ (that sounds like Michael Jackson by the way!)
    P.S. => One last thing. Is there any video tutorials for Xamarin (from 0 to Hero style) created by you? 'Cause i seem to consume knowledge far more better with videos.

    • @chrisjlocke
      @chrisjlocke 3 ปีที่แล้ว

      > Is there any video tutorials for Xamarin (from 0 to Hero style)
      I'm just learning Xamarin. WHat videos would you recommend?

    • @addtyu6176
      @addtyu6176 3 ปีที่แล้ว

      I also did the same thing about 5 months ago!!! And it was a bad decision... I really shouldve gone with flutter... XAMARIN, while it is native... the APP launch time is ridiculaus. My first App took 2 seconds to start!!

    • @chrisjlocke
      @chrisjlocke 3 ปีที่แล้ว

      @@addtyu6176 ; Did you mean '2 seconds' or '2 days' - 2 seconds to start doesn't sound that bad...

    • @addtyu6176
      @addtyu6176 3 ปีที่แล้ว +1

      @@chrisjlocke Are you seriously joking? 2 seconds is too long... Game apps, yes understandable, but utility apps should be less than a second. This is the norm for all apps like the Facebook App (Made with ReactNative), Phone, SMS App, Contacts App, Whatsapp, Telegram, reddit, AliBaba App (Made with flutter), linkedIn... all of them load under a second.

    • @rikudouensof
      @rikudouensof 3 ปีที่แล้ว

      Right? He is amazing. I also follow him in other social media, like twitter.

  • @scigama71
    @scigama71 2 ปีที่แล้ว +2

    This is great.. You are an excellent teacher. Thank you.

  • @mikegrainger8082
    @mikegrainger8082 3 ปีที่แล้ว

    This is great info and expertly explained. TVM.

  • @davidkim7812
    @davidkim7812 3 ปีที่แล้ว +1

    Hello James, this video is very useful for me. I have a great information.

  • @JonathanHobbe
    @JonathanHobbe 2 ปีที่แล้ว

    Really nice comming from the WPF world and watching this

  • @maxalmonte14
    @maxalmonte14 2 ปีที่แล้ว +1

    BEST... VIDEO... EVER!

  • @tapbrandsllc7982
    @tapbrandsllc7982 3 ปีที่แล้ว +1

    Thank you, James, for another useful video. My take-away, that I didn't know before, is that defining the BindingContext in the XAML, instead of in the code-behind, activates IntelliSense for editing the XAML file. NICE!!!

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว +1

      Yes, exactly!

    • @tapbrandsllc7982
      @tapbrandsllc7982 3 ปีที่แล้ว

      @@JamesMontemagno I tried defining the BindingContext in BOTH the XAML and the code-behind, expecting either an error or a warning. Instead, my app seems to compile and run just fine. Isn't this duplication of code (basically), and so shouldn't it be flagged by the analyzers?

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      @@tapbrandsllc7982 I use the d:ContentPage.BindingContext design time usually docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/xaml-previewer/design-time-data else you are creating 2 instances of it. I don't think analyzers are smart enough to figure that out.

  • @JasonPurkiss
    @JasonPurkiss 3 ปีที่แล้ว

    That was great thanks for that. ps thanks for all your hard work for ages my in app billing didn't work but the other day I upgraded to Xamarin forms 5 and the latest version of in app billing and it all came to life :) many thanks

  • @MrLordknoblauch
    @MrLordknoblauch 2 ปีที่แล้ว

    another incredibly informative session, although i'll really need to practice this to really get a grab on it.
    thanks

  • @davidwynn539
    @davidwynn539 2 ปีที่แล้ว

    Great video!

  • @vukilesimelane2033
    @vukilesimelane2033 3 ปีที่แล้ว +1

    Thank you soooo much James!!!!

  • @pauldudley1273
    @pauldudley1273 2 ปีที่แล้ว +2

    James towards the end of the video you talk about how the ViewModels become testable, Could you make a video in future on how you would go about testing stuff, Maybe a video just dedicated to testing would be awesome. Thanks for the great video series.

  •  3 ปีที่แล้ว

    Just perfect video!

  • @sudidav
    @sudidav 3 ปีที่แล้ว

    Very clear... Thanks James!!

  • @austintownsend3974
    @austintownsend3974 10 หลายเดือนก่อน

    We saw that World of Warcraft launcher James, you're the man.

  • @sem_the_man
    @sem_the_man 5 หลายเดือนก่อน +1

    You have enlightened me

  • @MukelabaiMukelabai
    @MukelabaiMukelabai 2 ปีที่แล้ว +1

    Thank God I found your channel!

    • @omarsebakhi
      @omarsebakhi 2 ปีที่แล้ว

      Me too, that's exactly what I felt!!!

  • @johnolawale2749
    @johnolawale2749 3 ปีที่แล้ว

    This is one awesome tutorial

  • @eduardoalvescanuto7135
    @eduardoalvescanuto7135 3 ปีที่แล้ว

    Thanks, your explain is amazing and very clear!

  • @Kokityo
    @Kokityo 2 ปีที่แล้ว

    Thank you, you saved my life !

  • @ritavafadar
    @ritavafadar ปีที่แล้ว +1

    You are 100% awesome :)

  • @marna_li
    @marna_li 3 ปีที่แล้ว +3

    In more advanced scenarios, I would wire up IoC and Dependency injection. Letting the IoC container resolve Pages, ViewModels, and Services. I inject ViewModels in the Page constructor. (There is a NavigationService involved) The downside is that you don't automatically get IntelliSense in your XAML views. Luckily, the x:DataType comes in handy.

  • @MarekLS60
    @MarekLS60 3 ปีที่แล้ว +1

    Great video tutorial...

  • @chester0bennington
    @chester0bennington 3 ปีที่แล้ว +1

    Thank you so much again!

  • @lifelover69
    @lifelover69 3 ปีที่แล้ว

    Excellent!

  • @keithkatane4854
    @keithkatane4854 ปีที่แล้ว

    Sublime. Thank you.

  • @alaminhossain3199
    @alaminhossain3199 3 ปีที่แล้ว +7

    You explain good, man. Damn good.

  • @buddysnackit1758
    @buddysnackit1758 2 ปีที่แล้ว

    OMG...If I find out your making us do this stuff and later in your MVVM helpers go..."Remember last time when we had to do all that tedious stuff, well good news folks! You don't have to do that tedious stuff! Which is where I run over to you and say "I am mentally slapping you right now for wasting 1000 peoples time you twit!".
    Very good! Right to the point.

  • @kidstube3239
    @kidstube3239 2 ปีที่แล้ว +1

    Compiled bindings are truly great feature of XAMARIN forms.

  • @veerendrashah3601
    @veerendrashah3601 3 ปีที่แล้ว

    Great and simplicity

  • @Vitormauricio
    @Vitormauricio 3 ปีที่แล้ว +6

    Excellent article! I really appreciate if you could record a video demo with a simple login and logout forms, using shell and JWT ;-)

  • @mukeshnishad1887
    @mukeshnishad1887 3 ปีที่แล้ว

    Nice article

  • @ddng9969
    @ddng9969 ปีที่แล้ว +1

    Thanks!

  • @PinkMappy
    @PinkMappy 2 ปีที่แล้ว

    James, I love you

  • @AmitTaparia
    @AmitTaparia 3 ปีที่แล้ว

    Hi James, great content as usual. I know my question is for advanced use of MVVM but I will ask here. Do you think the VM(View Model) should call data services to get data to be bound to the view or is it the model which should call the data services. Most of the examples I have seen around Xamarin Forms uses Data Service calls directly from VM but then their Models are just POCO. If I am writing a enterprise business app with lots of business logic(residing in my Models) then shouldn't I be calling the data services(fetching/saving data using rest/web services) from my models so that my models have an opportunity to validate those data before pushing out to the remote server?

  • @his-worddevotionals540
    @his-worddevotionals540 3 ปีที่แล้ว

    Thank you.

  • @KatoNamus
    @KatoNamus 2 ปีที่แล้ว

    Thank you

  • @rsrodas
    @rsrodas 3 ปีที่แล้ว +1

    Dear James...Thanks for the Show... Any tips for the right way to use gRPC in Xamarim? Doing a Show with these kind of topics could be nice for the community too... Thanks.

  • @olcatgaming859
    @olcatgaming859 3 ปีที่แล้ว +1

    7:49 as a beginner, when you did this. my brain just broke

  • @MrDinakdakan
    @MrDinakdakan 2 ปีที่แล้ว

    Hi james, I have a nuget packge video player, in a content view how to call method or bind the events of the player to my viewmodel/viewbase? thanks for the vid

  • @dominickdougherty4662
    @dominickdougherty4662 3 ปีที่แล้ว

    Question: I'm following along on a Mac with the M1. When I try to bind my ViewModel in my code(min 22). Visual Studio is not adding the namespace for me. When I add it myself it is not recognized.
    I can also not get the x: datatype to work.
    I get the error: " The type 'viewmodels:CoffeeEquipmentViewModel' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built"
    any suggestions?
    Thanks in advance

  • @talalmaman957
    @talalmaman957 2 ปีที่แล้ว

    You,ve a great experience and awesome explanation, please, can you publish a book for developing .net Maui Apps?

  • @jeffreywilliams3646
    @jeffreywilliams3646 ปีที่แล้ว

    Very helpful. Thank-you. I do not understand why they call it MVVM rather than VVMM, the latter much more accurately describing the flow of things. The former is very confusing to me.

  • @logank.70
    @logank.70 3 ปีที่แล้ว +2

    The amount of projects still putting business logic-y things in code behind makes me cry. I've had to teach this to pretty much every team I've worked with because it just isn't taught and people stay with what they know.

    • @chrisjlocke
      @chrisjlocke 3 ปีที่แล้ว

      Guess it depends on the languages you learned with. I started with VB5/6 which didn't really have classes, so buttons on the form did the work - added a record, got records to fill a grid, etc. Now with .Net and classes are a thing, its easier to split the tomato in half. Or something. I create database classes, but a lot of logic is still in the form buttons.

    • @logank.70
      @logank.70 3 ปีที่แล้ว

      @@chrisjlocke I wish more colleges spent time on code composition. Not every college/university is the same, but from what I've seen up to this point they mostly just go "these are objects, and here is how you make them." What I'd love to see are examples of taking things like a VB6 program written in the traditional way and showing how you can use composition within those boundaries. Still a good point though. Sometimes it's the limitations of a particular framework that make it much more difficult to compose things in a certain way.

  • @tapbrandsllc7982
    @tapbrandsllc7982 3 ปีที่แล้ว

    Quick question: Is the use of x:Datatype="viewmodels:XYZViewModel" REPLACING or IN ADDITION TO the use of [XamlCompilation(XamlCompilationOptions.Compile)] in the code-behind?

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว +1

      One is compiling XAML and one is compiled bindings, so 2 different things that work together :)

  • @cahyodwc
    @cahyodwc 3 ปีที่แล้ว

    Hi, is it best to set Model to implement INotifyPropertyChanged because i need a property updated when there is an action/update for each ViewCell ?

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว +1

      Yeah, you can also use mvvm helpers and observable object that will help you out. If you are updating a property on the model then go for it.

  • @makino500
    @makino500 2 ปีที่แล้ว

    Hi James, what program do you use for create this wonderful videos? Camtasia? Thanks a lot for this and other video!!!!!!

    • @JamesMontemagno
      @JamesMontemagno  2 ปีที่แล้ว

      I made a full video on this. Check it out: th-cam.com/video/ACzv4dEgrKA/w-d-xo.html

  • @joshua7597
    @joshua7597 2 ปีที่แล้ว

    Hey James. I don't know if it's a new update or anything. But in the Code-behind, there's no notification to use the namespace System.Windows.Input for ICommand. Hopefully I'm not stepping on any toes here. Have a great rest of your day.

  • @trandvinh
    @trandvinh 2 ปีที่แล้ว

    Very good video. Did you work for CDA (Cannon Development Amera)?

    • @JamesMontemagno
      @JamesMontemagno  2 ปีที่แล้ว

      Nope, it was part of Oce Reprographics Technologies which was acquired by Cannon.

  • @dbaznr
    @dbaznr 3 ปีที่แล้ว

    The contextual list on 23:17 don't worked for me (VS 2019), but the program runs with no problems. Is there any settings to enable this particular type of intelliSense?

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว +1

      In this instance I set the x:DataType but you can also set the Binding/DataContext and it should pick it up.

  • @tazwinsdevchannel
    @tazwinsdevchannel 2 ปีที่แล้ว

    With everything moving to the ViewModel at the end of the video. I didn't make the ViewModel inherit from BindableObject and it still worked?

    • @JamesMontemagno
      @JamesMontemagno  2 ปีที่แล้ว

      Depends what you are binding to. If you are just doing a property and not changing it from the code behind it will work or an observable collection.

  • @pjkarels
    @pjkarels 3 ปีที่แล้ว

    Does Xamarin Forms support {x:Bind PropertyName} (as in UWP), or is it in future plans to do so?

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว +1

      It doesn’t use x:Bind, but there something called compiled bindings which uses x:DataType and is very similar

  • @sajanpatel6751
    @sajanpatel6751 2 ปีที่แล้ว

    Hi James, Data biding would not work with Entry right? it only works with things that wants to send some output rather than getting input only like Entry in Xaml

    • @JamesMontemagno
      @JamesMontemagno  2 ปีที่แล้ว +1

      DataBinding totally works with Entry! It is two way data binding

  • @robertodalmonte504
    @robertodalmonte504 3 ปีที่แล้ว

    Hi James, great sample.
    I followed your tutorial to set a WPF project instead, and I used
    .DataContext (instead of .BindingContext) but could not find a way to use x:DataType...sure enough as per my ignorance.
    How would you do it in a wpf project?

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      That is correct on the WPF part it is DataContext (as well for UWP). And then take a look at x:Bind instead of x:DataType docs.microsoft.com/en-us/windows/uwp/xaml-platform/x-bind-markup-extension

    • @robertodalmonte504
      @robertodalmonte504 3 ปีที่แล้ว

      @@JamesMontemagno Does x:Bind apply to WPF as well, or is it only for UWP?

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      @@robertodalmonte504 Yes, I think x:Bind is only UWP. I don't know if there is a similar option for WPF, but look at the VS tooling for binding diagnostics, which should help out
      th-cam.com/video/vg-Sx1F7aCo/w-d-xo.html

    • @robertodalmonte504
      @robertodalmonte504 3 ปีที่แล้ว

      @@JamesMontemagno Thanks James for your info and your time... this is a Dmitry Lyalin 5 minutes video about the very same topic, in case someone is interested.
      th-cam.com/video/mzI-7iaKeQs/w-d-xo.html

  • @jean-baptistedioli1692
    @jean-baptistedioli1692 ปีที่แล้ว

    Hello. Thanks so much the courses.
    I've just have one question, I do not understand how to updated the form in the view from the contentPage. the only way I found is by doing BindingContext = myViewModel and this is for me a duplication with the BindingContext that you do in the view, (XAML page). I hope you understand me.
    Thank you :)

    • @JamesMontemagno
      @JamesMontemagno  11 หลายเดือนก่อน +1

      Yes! You can actually just set the "BindingContext = this;" and that will set the page as the binding source.

  • @jcvandermerwe5311
    @jcvandermerwe5311 3 ปีที่แล้ว

    Is there anything specific around working with Xamarin.Essentials Media Picker in MVVM and Data Binding? The moment I apply data binding and mvvm to my code behind the camera doesn't launch...? Any suggestions will be greatly appreciated. And thank you for all of your online stuff, as a new Xamarin developer you are my dreams come true, no jokes.

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      Not sure, i would look at the sample probably, should work alright.

  • @greeksinmars
    @greeksinmars 3 ปีที่แล้ว

    How can pass parameters between viewModels ?? in MVVM

  • @varunchopraapj
    @varunchopraapj ปีที่แล้ว

    To make the intellisense in MAUI working you need to add a DataType with clr namespace in the ContentPage header
    ```
    xmlns:mauiAppLearn="clr-namespace:MauiAppLearn"
    x:DataType="mauiAppLearn:MainPage">
    ```

  • @buddysnackit1758
    @buddysnackit1758 2 ปีที่แล้ว +1

    James, Can you tell me why Microsoft has not simply made MVVM a project type and given the user simple xaml popups to create the command options for buttons and similar for other controls. I mean how hard could it be if your starting MVVM had 1 view 1 view model and 1 Model? Then adding the code to complete or populate these files should be VERY similar to how it currently works. Oh and if that is a thing already I'm very interested in what that would be.
    ALSO: I create a new xaml project for windows applications and run the default stuff it makes. It works. I install xamarin and it won't compile because of a couple errors generated in that magic code in the xaml. I uninstall xamarin and it works again...so I'll watch your video and maybe you address it.

  • @matteoc7084
    @matteoc7084 3 ปีที่แล้ว +1

    I'm using a tabbed app. I'm not sure how to do it that when you press button on one tab it updates content on another tab?

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      You could share your view model between the two different pages.

    • @matteoc7084
      @matteoc7084 3 ปีที่แล้ว

      @@JamesMontemagno and could I also share it with more than 2 tabs? It would be great if you could make a video about it.

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      @@matteoc7084 Sure you could just set the BindingContext on any and all pages.

  • @deaasaleh3613
    @deaasaleh3613 3 ปีที่แล้ว

    Hello James, thank you for great explanation
    Why you are not on the xamarin forms 5 launch party with the team ??

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว +1

      I was there in support in the chat :)

  • @ClarenceSimukanzye
    @ClarenceSimukanzye 3 ปีที่แล้ว +1

    Where's the link to the previous video?

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      Here is the Xamarin 101 playlist th-cam.com/play/PLwOF5UVsZWUiHY1CkRVjYJ6dm0iCvAlfw.html

    • @ClarenceSimukanzye
      @ClarenceSimukanzye 3 ปีที่แล้ว

      @@JamesMontemagno thank you!

  • @tsilb
    @tsilb 2 ปีที่แล้ว

    Every MVVM tutorial I've found uses ContentPages for their views. Why, then, is there a separate View item in the VS Add New Item dialog?

    • @JamesMontemagno
      @JamesMontemagno  2 ปีที่แล้ว

      You can create small composable views that can go into pages if you desire.

  • @Zygotic11
    @Zygotic11 2 ปีที่แล้ว

    Nice but how do I move to another view? i.e. a new page

  • @Kuuma
    @Kuuma 3 ปีที่แล้ว

    Is it possible for someone to look at my code? The context list never appeared for me @ 23:17 , and after I tried to move on without it, the whole thing just collapsed, and now I have no idea how much damage I did trying to walk back a slew of errors.

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      Best to post over at docs.microsoft.com/en-us/answers/products/dotnet

  • @dogukantombul1045
    @dogukantombul1045 2 ปีที่แล้ว +1

    this "you clicked .. times" thing didnt work on my android device

  • @hadirotafoua5381
    @hadirotafoua5381 3 ปีที่แล้ว

    hi.. i had this error at the end
    Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR)....

    • @JamesMontemagno
      @JamesMontemagno  3 ปีที่แล้ว

      Would do report a problem in VS, not sure without context

    • @hadirotafoua5381
      @hadirotafoua5381 3 ปีที่แล้ว

      @@JamesMontemagno it works fine without bindingcontext

  • @rdvansunger5607
    @rdvansunger5607 2 ปีที่แล้ว

    I am new at Xamarin, my binding doesnt work. I checked many times that i did everything same with James. When I move the cursor to "CountDisplay" at the xaml page I see warning "No datacontext for binding" message. Can anyone help with that please?

    • @JamesMontemagno
      @JamesMontemagno  2 ปีที่แล้ว

      Did you set the BindingContext? Would need to see a repro, but if you follow along should be good to go.

    • @rdvansunger5607
      @rdvansunger5607 2 ปีที่แล้ว +1

      @@JamesMontemagno I did repro and it works now. Thanks a lot for the reply and providing such wonderful series 🙏