Turn any Event into a Command in Xamarin.Forms (MVVM All The Things)

Поділитися
Вставка
  • Опубліковано 19 гру 2024

КОМЕНТАРІ • 57

  • @rikudouensof
    @rikudouensof 2 роки тому +2

    After months on end, I am back here again

  • @robertojrcantos1711
    @robertojrcantos1711 3 роки тому +2

    This is so cool James. The best. Keep the best work!!!

  • @Otonium
    @Otonium 2 роки тому +1

    It would be cool to have a playlist of all the episodes of this coffee app. Thank you!!

    • @JamesMontemagno
      @JamesMontemagno  2 роки тому

      It exists! ua-cam.com/play/PLwOF5UVsZWUiHY1CkRVjYJ6dm0iCvAlfw.html

  • @magnemmar4869
    @magnemmar4869 3 роки тому +2

    Re: my now removed question -- I'm hitting an issue with the ItemSelectedEventArgsConverter. Builds fine. Deploy fails with error "XFC0000: Cannot resolve type "xct:ItemSelectedEventArgsConverter"
    In case it helps anyone who runs into this on VS2022 and Windows (caveat only because I didn't try this on a mac). Close VS, manually delete the obj and bin folders. Then (for good measure), stop and restart the Android emulator.
    Load the solution back up and that should resolve this issue. I do want to note that I ran into this on a 100% new solution while I was troubleshooting, so it's possible the actual solution was just bouncing the emulator.

  • @jayveebelano9041
    @jayveebelano9041 2 роки тому +1

    amazing vid james!

  • @paragshedbale
    @paragshedbale 2 роки тому +1

    How do we do this for the 'Unfocused" event for an entry in .NET Maui? I do not see any "UnFocusedEventargsConverter" in the .NET MAUI community toolkit?

  • @mikegrainger8082
    @mikegrainger8082 3 роки тому +2

    James, another great video thanx for your presentation. Any chance these have been pushed to Git?

  • @belmiris1371
    @belmiris1371 3 роки тому +3

    As of the time of this post and Xamarin Community Toolkit 1.3.1, the SelectedCoffee = null problem still occurs.
    Frankly I'm a little confused WHY it's so important to set it to null.
    Did I miss something in an earlier video, I've watched them all.

    • @JamesMontemagno
      @JamesMontemagno  3 роки тому +1

      You set it to null to deselect it

    • @belmiris1371
      @belmiris1371 3 роки тому

      @@JamesMontemagno - Yes but why is deselecting it so important? Is there an issue with leaving a collection item selected?

    • @JamesMontemagno
      @JamesMontemagno  3 роки тому +2

      @@belmiris1371 Ah so usually if you don't deselect then the user can't press it again. So deselecting will make sure the user can click on it again.

    • @belmiris1371
      @belmiris1371 3 роки тому

      @@JamesMontemagno okay, that makes sense. Thanks!

  • @ilyashitchens649
    @ilyashitchens649 2 роки тому +1

    Hey James, I may need your advice, here is my question : I'm currently working on implementing the BackButtonPressed Event and I want to do it the MVVM way, my issue is that when I'm trying to use the behavior eventToCommand and a command by definition returns nothing while my BackButtonPressed return a boolean. I need the command to return true so that my app doesn't close.
    Hope you can guide me thank you :)

  • @echo222ify
    @echo222ify 3 роки тому +1

    Hi James many thanks for these videos.. these are incredibly helpful. I have been struggling now with one item and was wondering if you can maybe do one of your magic tutorial videos. Effectively I would like to know how I can use a data item which is generated in my main page viewmodel upon a selection, in a SecondPage viewmodel script, such that I can use that transferred data to bind in a SecondPage view. Many thanks in advance. Sorry if this is not really clear, i am really at the start of learning xamarin.

    • @echo222ify
      @echo222ify 3 роки тому

      I am not sure whether this is the best way but I defined the variable as public static ToBeSentData in viewmodel1 and in vewmodel2 I referred to it as public ReceivedData = viewmodel1.ToBeSentData which seemed to work. But if you can please direct me to any generic resources that you find useful that will be much appreciated. Thanks.

  • @mishalchowdhary3576
    @mishalchowdhary3576 3 роки тому +2

    Hello James
    Your videos are awesome.
    one doubt i have for the above video is that will this technique still work if i change the ui as this seems to be ui specific mvvm. thanks in advance.

    • @JamesMontemagno
      @JamesMontemagno  3 роки тому

      I wouldn't see why there would be an issue, Commands can be bound to just about anything with the EventToCommand.

    • @mishalchowdhary3576
      @mishalchowdhary3576 3 роки тому

      @@JamesMontemagno Thanks for the reply.

  • @troupebase2292
    @troupebase2292 2 роки тому +1

    Will this work just the same on maui as demonstrated?

    • @JamesMontemagno
      @JamesMontemagno  2 роки тому +1

      Yup, but with the .net Maui community toolkit

    • @troupebase2292
      @troupebase2292 2 роки тому

      @@JamesMontemagno thanks James. Keep up the good work!

  • @JamesChurchill3
    @JamesChurchill3 2 роки тому +1

    So since this is dealing with coffee selections, isn't this just a Java app?

  • @robertcolvin5162
    @robertcolvin5162 3 роки тому +1

    Is this unavailable to CollectionView? I'm crashing whenever I try to use this.

  • @beezow7113
    @beezow7113 3 роки тому +1

    excellent tutorial series.

  • @kuzco7061
    @kuzco7061 2 роки тому +1

    10:25 - 1 year later and this still hasn't been fixed XD

  • @25kyro
    @25kyro 3 роки тому +1

    Is there a way to do this for scrolling?? To detect that the user scrolled in mvvm

  • @ovidiufelixb
    @ovidiufelixb 3 роки тому +2

    Hey James. I recently found your channel and I love this series.
    I have a question regarding ListView/CollectionView: is there a particular reason for undoing the selection after it happens? Is it purely visual, or does it serve a different purpose? Is it like a best practice? Are there any downsides to just keeping the selected item selected?

    • @JamesMontemagno
      @JamesMontemagno  3 роки тому +2

      If you don't deselect it then the user can't select it again is the main issue. So it depends on your app and what you are going for.

  • @olegtortajadaamoros6336
    @olegtortajadaamoros6336 Рік тому

    How is possible to uncolor selectedItem?
    I am agree with "SelectedCoffee=null", but does not really atractive the orange selected at the background, wich never desapears

    • @JamesMontemagno
      @JamesMontemagno  Рік тому

      One way I do it is have a selected property and change the background color of the cell based on it. Or add an effect shimmer (syncfusion) to it and unselect it on tap

    • @olegtortajadaamoros6336
      @olegtortajadaamoros6336 Рік тому +1

      ​@@JamesMontemagno thank you, solved worked with a trigger on checkbox at element list:

    • @JamesMontemagno
      @JamesMontemagno  Рік тому

      Nice!

  • @Samossam
    @Samossam 3 роки тому +1

    Is there a way to do something equivalent with the MVVM Toolkit (from the Windows Community Toolkit) ?

    • @JamesMontemagno
      @JamesMontemagno  3 роки тому +1

      So, the Xamarin Community Toolkit has lots of goodies in there, I also have my own library called MVVM Helpers -> ua-cam.com/video/y8ZqEOLDeo8/v-deo.html The mvvm toolkit will also work great with Xamarin apps.

  • @josepvg
    @josepvg 3 роки тому +1

    Thanks for a great video like always. Is there any behaviour so i can get a command called on my viewmodel when it appears? It would be nice to have an async entry point on my viewmodel when my page is displayed. Often at that point we fetch some data

  • @pnspierenburg
    @pnspierenburg 3 роки тому +1

    Cool James! Is it possible to use the EventArgsConverter with a CollectionView Behavior using the SelectionChanged Event ?

    • @JamesMontemagno
      @JamesMontemagno  3 роки тому +2

      Should be able to! Else it takes any converter so should be able to create your own really easily.

  • @DigitalElectronicSchool
    @DigitalElectronicSchool 3 роки тому +2

    only you James can answer me
    if I move to xamarin5 is it ok with old android ?
    or
    what is the minimum android can xamarin5 supported?
    or
    how can I release to kit kat android 4.4 with xamarin5?
    thank you very very much James
    you are really friend of all developers in all world
    thank you again

    • @JamesMontemagno
      @JamesMontemagno  3 роки тому +2

      Xamarin.Forms 5 still support 4.4, you are good to go. I would only recommend if you are targeting a specific device. If you are releasing to google play just a normal app you should really think of targeting something like 6.0+

    • @DigitalElectronicSchool
      @DigitalElectronicSchool 3 роки тому +1

      @@JamesMontemagno Thank you so much ..

    • @DigitalElectronicSchool
      @DigitalElectronicSchool 3 роки тому +1

      @@JamesMontemagno One more thing if you still there
      when I debug to kit kat 4.4 its ok
      but when I release its crashed .. dose not work
      am I forget something?
      I am new in xamarin
      thank you James .. Thank you soooooooooooooooo much

  • @efexzium
    @efexzium 3 роки тому +1

    Anyone getting an error with the androide OS on Visual studio Community?

    • @JamesMontemagno
      @JamesMontemagno  3 роки тому +1

      For technical support -> docs.microsoft.com/en-us/answers/products/dotnet

    • @efexzium
      @efexzium 3 роки тому +1

      Thanks fixed it, it was the file names where to long.

  • @SaurabhKumar-ys1rk
    @SaurabhKumar-ys1rk 3 роки тому +1

    Thank you so much Sir

  • @ElCidPhysics90
    @ElCidPhysics90 Рік тому

    I know this is more philosophical, but are apps built with xamarin forms perceived to operate the same as those built directly in Xcode?

    • @JamesMontemagno
      @JamesMontemagno  Рік тому +1

      Xamarin.Forms and .NET MAUI use native controls and you can style how you want. So it all depends on how you are designing your apps at the end of the day. Plenty of apps built in Swift that look nothing like standard Apple apps.

    • @ElCidPhysics90
      @ElCidPhysics90 Рік тому

      @@JamesMontemagno thank you. Do you have any videos on creating an app for iPad? I know you can run an iPhone app on an iPad but those stink. I’d like to byiild an app that runs properly on iPhone and iPad.

  • @2005Azm
    @2005Azm 3 роки тому +1

    xamarin forms Shell how to exit app from flyout logout Item ?

    • @JamesMontemagno
      @JamesMontemagno  3 роки тому +1

      You would have to register some sort of exit app event however you really shouldn't do that at all. I think only available on Android to exit and app and I don't think on iOS.

  • @andreaguidali1472
    @andreaguidali1472 3 роки тому +1

    James Number One!

  • @jespinalny
    @jespinalny 2 роки тому +1

    This video violates Inversion Of Control. You are "newing up" lots of concrete Commands and that is a no-no. Not good advice.