DotNet MAUI MVVM: Deep Dive into MVVM Architecture with .NET MAUI

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • DotNet MAUI Tutorial Series: • .NET MAUI - Learn DotN...
    In this video tutorial, we will explore the implementation of the Model-View-ViewModel (MVVM) pattern in .NET MAUI, a powerful cross-platform framework for mobile app development. We'll dive into the concepts of MVVM and its significance in building robust and maintainable applications. Throughout the tutorial, we'll cover various aspects such as data bindings, commands, navigation, and the utilization of the .NET MAUI MVVM toolkit. We'll compare MVVM with other architectural patterns like MVU and showcase examples and real-world scenarios to demonstrate the effectiveness of MVVM in .NET MAUI. By the end of this tutorial, you'll have a solid understanding of how to leverage the MAUI MVVM framework to develop feature-rich, cross-platform Android applications. So, if you're interested in mastering .NET MAUI MVVM and enhancing your Android development skills, this tutorial is perfect for you. Join us and let's get started on this exciting journey!
    The Model-View-ViewModel (MVVM) pattern, a cornerstone of .NET MAUI development, ensures a well-defined separation between three crucial software layers: the view, representing the XAML user interface (UI); the model, encompassing the underlying data; and the viewmodel, serving as the intermediary between the view and the model. Through the power of data bindings defined in XAML, the view and viewmodel establish a seamless connection. In the world of .NET MAUI, this pattern finds its natural home, enabling efficient cross-platform mobile app development.
    When implementing a XAML page that displays a clock with the current time, additional code is required. Leveraging the strengths of the MVVM pattern, .NET MAUI apps benefit from seamless data binding between visual objects and the underlying data. In the MVVM mindset, the model and viewmodel classes are typically written in code, while the view is often defined in a XAML file that references properties from the viewmodel through data bindings. MVVM emphasizes the separation of concerns, with the model being unaware of the viewmodel and the viewmodel being unaware of the view. However, it is common to tailor the types exposed by the viewmodel to align with those used in the UI.
    In MVVM, viewmodels often implement the INotifyPropertyChanged interface, enabling classes to raise the PropertyChanged event whenever a property changes. The powerful data binding mechanism in .NET MAUI subscribes to this event, ensuring the view stays updated with the latest values.
    Two-way data bindings, a hallmark of MVVM, empower interactive views that synchronize with the underlying data model.
    In some scenarios, app requirements extend beyond simple property bindings, necessitating user-initiated commands that affect the viewmodel. Traditionally, such commands were handled in the code-behind file through event handlers like Clicked or Tapped. However, the commanding interface provides a more MVVM-friendly approach to command implementation. The viewmodel can expose commands, which are methods executed in response to specific view activities, such as button clicks. These commands are seamlessly bound to buttons or other UI elements through data bindings.
    In this comprehensive .NET MAUI MVVM tutorial, we'll explore the nuances of the MVVM pattern, leveraging the extensive .NET MAUI MVVM library and tools. We'll dive into practical examples, including commanding scenarios, to demonstrate the power and flexibility of MVVM within the .NET MAUI framework. Whether you're an Android developer, aiming to create cross-platform mobile apps, or a newcomer to mobile app development, this tutorial equips you with the knowledge and skills to build robust and scalable applications.
    Join us on this transformative journey into the world of .NET MAUI MVVM and unlock the full potential of cross-platform mobile app development. Start building your next-generation mobile apps today and embrace the future of Android development with .NET MAUI!

Комментарии • 94

  • @CodingDroplets
    @CodingDroplets  Год назад

    ⭐ Join Us on Patreon: www.patreon.com/CodingDroplets
    .NET MAUI Tutorial Series:
    ruclips.net/video/O3-jFuXqASE/видео.html

  • @tide_pods_707
    @tide_pods_707 Год назад +13

    best explanation of MVVM ive ever seen. Thank you.

    • @CodingDroplets
      @CodingDroplets  Год назад +2

      Thank you so much for your kind comment! I'm glad to hear that you found the explanation of the MVVM pattern helpful.

  • @zakirdev
    @zakirdev 9 месяцев назад +4

    Very soon you gonna be Microsoft MVP. Last 6 months I have tried many tutorials. I also completed some Udemy courses. But your teaching is better than any tutorials on Udemy and RUclips. You are the best. Thank you so much for delivering valuable tutorials for free. ❤❤

    • @CodingDroplets
      @CodingDroplets  9 месяцев назад +1

      Thank you so much for your incredibly kind words! I'm thrilled to hear that you find the tutorials helpful, and I genuinely appreciate your support and encouragement. Your feedback inspires me to continue creating valuable content. Thank you for being a part of this community, and I'm honored to have you as a viewer! ❤️❤️

    • @SmokeSerpant
      @SmokeSerpant 3 месяца назад

      amen

  • @macupie
    @macupie Год назад +4

    That's my first video from you and well, I did not have expected to have such a harmonic synergy between explanation and video editing! This really is a game changer! And.. oh yeah, thx for the information btw :D

    • @CodingDroplets
      @CodingDroplets  Год назад

      Thank you for watching our video and for your positive feedback! We're delighted that you found the content engaging.

  • @morsheddld
    @morsheddld 2 месяца назад +2

    truly this tutor is genius ❤. This is my first video watching in your channel so liked it n subscribed and become a fan of u, u r a star . expect more content from you. may god bless you.

    • @CodingDroplets
      @CodingDroplets  2 месяца назад +1

      Thank you so much for your kind words! Happy to hear that you found it helpful. Welcome to the channel, There's plenty more content on the way, so stay tuned! May God bless you too. 😊

    • @morsheddld
      @morsheddld 2 месяца назад +1

      @@CodingDroplets sure my dear, I'm going to watch all of your tutorials. It's really very useful.

    • @CodingDroplets
      @CodingDroplets  2 месяца назад

      Thank you so much!

  • @teriyakov
    @teriyakov 6 месяцев назад +3

    New fan here. Brilliant video and very clear and concise explanations. Thank you!

    • @CodingDroplets
      @CodingDroplets  6 месяцев назад +1

      Thank you so much for your kind words! I'm thrilled to have you as a new fan, and I'm delighted to hear that you found the MAUI MVVM tutorial helpful.

  • @user-ps3gc6wu9i
    @user-ps3gc6wu9i Год назад +3

    You are a good teacher keep it up ;)
    For a second I thought you weren't going to use a command and then boom my ocd fixed haha :p good job.

    • @CodingDroplets
      @CodingDroplets  Год назад

      Thank you so much for your kind words and positive feedback.
      Your feedback and support inspire me to keep improving and creating valuable contents.

    • @user-ps3gc6wu9i
      @user-ps3gc6wu9i Год назад +1

      @@CodingDroplets I hope you stay like this interactive with people even when you become famous dont forget us ehh :)

    • @CodingDroplets
      @CodingDroplets  Год назад

      Thank you so much for your heartwarming comment! I truly appreciate your kind words and support.
      Interacting with my viewers and building a strong community is essential to me, and I promise that I'll always strive to stay engaged and responsive, no matter how big my channel grows.
      My viewers, like you, are the reason I create content, and your feedback and input are invaluable in shaping the direction of my channel. Your learning and success in your coding journey are my top priorities.
      As I continue to grow, I'll always remember the support and encouragement I've received from viewers like you. I'm committed to maintaining this positive and interactive environment and creating content that's helpful and informative.
      If you ever have any questions, suggestions, or topics you'd like me to cover in my future videos, please don't hesitate to let me know. Your involvement is what makes our community special.

  • @swamysivakumarYalamati
    @swamysivakumarYalamati Месяц назад +1

    that was an awesome video. you are a monster in this tech

    • @CodingDroplets
      @CodingDroplets  Месяц назад

      Thank you so much for your kind words! Glad to know that you liked the video.

  • @camilofernandez8765
    @camilofernandez8765 6 месяцев назад +1

    Nuevo suscriptor :
    Gracias por enseñar me alegra que haya gente como usted.

    • @CodingDroplets
      @CodingDroplets  6 месяцев назад

      ¡Bienvenido, y muchas gracias por suscribirte! Me alegra mucho que hayas encontrado útil el tutorial. Siempre es un placer ayudar y compartir conocimientos con personas interesadas como tú.

  • @rohithkumar-bt2jv
    @rohithkumar-bt2jv 10 месяцев назад +1

    Observable property really made my work easy.

    • @CodingDroplets
      @CodingDroplets  10 месяцев назад

      I'm glad to hear that using observable properties made your work easier! They are indeed a powerful feature in MVVM.

  • @talkathiriify
    @talkathiriify 7 месяцев назад +1

    Explanation is more than wonderful.
    Thank you so much.

    • @CodingDroplets
      @CodingDroplets  7 месяцев назад

      Thank you for your kind words! I'm glad you found the explanation helpful.

  • @kopilkaiser8991
    @kopilkaiser8991 11 месяцев назад +1

    Best explanation for this subject. I was able to understood all your explanations.

    • @CodingDroplets
      @CodingDroplets  11 месяцев назад

      Thank you so much for your kind words! I'm delighted to hear that the explanation was helpful and easy to understand.

  • @RDGTECH7
    @RDGTECH7 8 месяцев назад +1

    Thanks you bro for make this video , this helpme alot for my tesis , im building an medical appoiment i this is so helpfull cause im new on maui and mvvm , ty for make my journey better

    • @CodingDroplets
      @CodingDroplets  8 месяцев назад

      You're very welcome! I'm thrilled to hear that the tutorial has been helpful for your medical appointment app and your thesis. It's great that you found the content beneficial as you navigate through MAUI and MVVM.

  • @9to5Abroad
    @9to5Abroad 8 месяцев назад +2

    Great instructions, thanks!

  • @Ramasanda
    @Ramasanda 5 месяцев назад +1

    Thank you for your amazing tutorials. please add a new video about best ways for binding data in mvvm structure. Considering dependency and professionalism.

    • @CodingDroplets
      @CodingDroplets  5 месяцев назад

      Thank you for your feedback and for watching the tutorials! I'm glad you find them helpful. Your suggestion for a video on the best practices for data binding in the MVVM structure is excellent, and I'll definitely consider creating one.

  • @jimmyt_1988
    @jimmyt_1988 Год назад +1

    8:30 - "John Thomas" - Phahaha. This made me laugh. In UK, that is slang for something else. Excellent video. Thank you so much!

    • @CodingDroplets
      @CodingDroplets  Год назад

      I appreciate your feedback! I'm glad the video brought a smile to your face. I'm not entirely sure about the slang reference you mentioned, as it can vary by region, but I'm pleased to hear that you found the content excellent.

  • @plaaggeest64
    @plaaggeest64 11 месяцев назад +1

    I love you my friend you saved me!

    • @CodingDroplets
      @CodingDroplets  11 месяцев назад

      I'm glad to hear that the tutorial was helpful for you! Thank You so much

  • @johnmaguire2185
    @johnmaguire2185 11 месяцев назад +1

    Really like the way you make the videos.

    • @CodingDroplets
      @CodingDroplets  11 месяцев назад

      Thank you so much for your positive feedback! Glad to hear that.

  • @arvindchourasiya4738
    @arvindchourasiya4738 Год назад +2

    Great video. So much information. I was looking for a part where to attach view to viewmodel instead you created binding context in code behind. This is not pure mvvm. Thank you

    • @CodingDroplets
      @CodingDroplets  Год назад +1

      Thank you for watching and sharing your feedback with us! We're glad to hear that you found the video informative.
      In an upcoming tutorial, we'll dive into the concept of dependency injection and discuss how it can be used to attach the view model to the view in a more loosely coupled manner.

  • @avijitnandi5879
    @avijitnandi5879 Год назад +1

    Really great video I learnt and cleared my basics. I request you to make video on the validations of the employee user input. Thanks.

    • @CodingDroplets
      @CodingDroplets  Год назад +1

      Thank you for your positive feedback! I'm glad to hear that you found the tutorial helpful and that it cleared your basics.
      Regarding your request for a video on validating employee user input, that's a great suggestion! Validations are an important aspect of application development, and I'll definitely consider creating a video specifically focused on implementing input validations in the context of employee data.

    • @avijitnandi5879
      @avijitnandi5879 Год назад +1

      @@CodingDroplets Thank you Sir

  • @SuchithM
    @SuchithM Год назад +3

    I think here deviated with MVVM pattern. Listview_ItemTapped used in the code behind instead of view model, is it not the deviation from MVVM pattern ?

    • @CodingDroplets
      @CodingDroplets  Год назад +4

      Thank you for your comment and bringing up an important point about the MVVM pattern.
      In MVVM, it's generally recommended to handle events and user interactions in the view model instead of the code-behind. This helps to maintain a separation of concerns and keep the view model responsible for the business logic.
      However, it's worth mentioning that the MVVM pattern is flexible, and there can be scenarios where handling events in the code-behind might be appropriate, especially for simpler scenarios or quick prototyping. In that part of the tutorial, the focus might have been more on demonstrating the ListView Tapped functionality.
      That being said, it's a good practice to strive for a more pure MVVM implementation by handling events and user interactions in the view model. This promotes better code organization and testability.
      Thank you for bringing this up, and I appreciate your attention to detail. If you have any further questions or need clarification, feel free to ask. Happy coding!

  • @OrcanTech
    @OrcanTech Год назад +1

    great video. easy to follow. thanks.

    • @CodingDroplets
      @CodingDroplets  Год назад

      Thank you so much for your kind words! I'm glad to hear that you found the video great and easy to follow.

  • @user-vp8fx7nl4s
    @user-vp8fx7nl4s 8 месяцев назад +1

    Awesome video

  • @enricoroselino7557
    @enricoroselino7557 2 месяца назад +2

    so you put vm:viewmodel in xaml and also put it on DataContext on code behind

    • @CodingDroplets
      @CodingDroplets  2 месяца назад +1

      In the tutorial, I assign the ViewModel to the BindingContext in the code-behind. This ensures that the ViewModel is correctly bound to the view, allowing for proper data binding and interaction. Thanks for watching!

  • @oktjona
    @oktjona Год назад +1

    Great video thnkx simplified

    • @CodingDroplets
      @CodingDroplets  Год назад

      Thank you for your feedback! I'm glad you found the video helpful and simplified.

  • @stscomputerchaibasa1928
    @stscomputerchaibasa1928 Год назад +1

    well done , i request you to make a tutorial on crud with sqlite3 also.

    • @CodingDroplets
      @CodingDroplets  Год назад

      Thank you for your kind words and the suggestion! We appreciate your feedback. The idea of creating a tutorial on CRUD operations with SQLite3 in the context of .NET MAUI is a valuable one. We'll certainly consider your request for future content.

  • @user-px4dw3bs9u
    @user-px4dw3bs9u 4 месяца назад +1

    Can you provide a complete case of data addition, deletion, modification, and search, teacher?

    • @CodingDroplets
      @CodingDroplets  4 месяца назад +1

      Thank you for your comment! I appreciate your interest in seeing a complete case example. While the tutorial focused on the basics of MVVM architecture, I'll definitely consider creating more detailed tutorials that cover these specific operations in the future.

  • @TheMtahir786
    @TheMtahir786 Год назад +1

    DO I need to use this model even when I using a database?
    please help

    • @CodingDroplets
      @CodingDroplets  Год назад

      Absolutely, using the MVVM (Model-View-ViewModel) pattern and data binding is still beneficial when working with a database in MAUI. It helps maintain separation of concerns and makes your code more maintainable, even when dealing with data retrieval and storage operations from a database. MVVM can help organize your app's logic and user interface effectively.

  • @lcppb
    @lcppb 10 месяцев назад +1

    If possible, do a search for a typed text and show the result... and then click on this result and open its details on another screen...MVVM. Thank you

    • @CodingDroplets
      @CodingDroplets  10 месяцев назад

      Thank you for your suggestion! Performing a search for typed text and demonstrating the display of search results along with the ability to view details on another screen is an excellent idea to explore the MVVM pattern.
      I'll definitely consider creating a tutorial that covers this scenario, as it's a common and valuable use case.

  • @hungchip
    @hungchip 7 месяцев назад +1

    Hi Master, can you make a Video MVVM work with EF Core 8.0.2? that will is perfect!

    • @CodingDroplets
      @CodingDroplets  7 месяцев назад

      Thank you for your suggestion! I appreciate your interest. It's a valuable topic, and I'll definitely consider creating a tutorial on that.

  • @user-ps3gc6wu9i
    @user-ps3gc6wu9i Год назад +1

    can I request a tutorial ?
    Sometimes you have two viewmodels and you want to pass a value from 1 viewmodel to another one how would you do that?
    I have never seen a tutorial about it.
    In the last bits of this video you were doing something similar but then you were navigating to that page so it wasn't a problem. like : 25:58 where you had empoyeedetailviewmodel and where passing a value.

    • @CodingDroplets
      @CodingDroplets  Год назад

      Thank you for watching and for your tutorial request! We appreciate your engagement and the interesting topic you've brought up.
      To clarify your request, when you mention showing the second view without navigation, are you referring to scenarios where you need to communicate data between two view models within the same page? Or do you have another specific scenario in mind where navigation is not desired?
      Understanding the context of your request will help us create a tutorial that best addresses your needs and provides the most relevant solutions.

    • @user-ps3gc6wu9i
      @user-ps3gc6wu9i Год назад +1

      @@CodingDroplets ok so when you have a view A with a viewmodel A and then a view B with a ViewModel B
      Thanks

    • @CodingDroplets
      @CodingDroplets  Год назад

      Thank you for providing further clarification! There are several approaches you can take. Here are a couple of common solutions.
      Using Dependency Injection: You can inject ViewModel A into ViewModel B (or vice versa). This way, both ViewModels can share data directly.
      Event Aggregator Pattern: ViewModels can communicate through an event bus that acts as a mediator. ViewModel A publishes an event containing the data, and ViewModel B subscribes to that event and receives the data when it's raised.
      In our upcoming videos in this series, we'll be discussing in detail about both these options. Stay tuned for the upcoming tutorial, and happy coding!

  • @brooklynsaia409
    @brooklynsaia409 10 месяцев назад

    I’m getting a lot of errors and unexpected using statements that aren’t in the video are required to bind.. could you lend some insight as to why I would be getting an error when I’m trying to populate 11:14

    • @CodingDroplets
      @CodingDroplets  10 месяцев назад

      I'm sorry to hear you're encountering errors. You can find the source code for the tutorial at this GitHub repository: github.com/codingdroplets/MauiMvvmDemo.
      I recommend cloning the repository and comparing your code to the one provided in the tutorial to identify any differences or missing components that might be causing the errors.

  • @swamysivakumarYalamati
    @swamysivakumarYalamati Месяц назад +1

    more videos on community toolkit maui.

    • @CodingDroplets
      @CodingDroplets  Месяц назад

      Thanks for the suggestion! We'll be doing more videos on the Community Toolkit for MAUI soon. Stay tuned!

  • @johnmaguire2185
    @johnmaguire2185 11 месяцев назад +1

    I wonder if you could demonstrate a simple store for the employee data to have it persist.

    • @CodingDroplets
      @CodingDroplets  11 месяцев назад

      Thank you for your comment! I appreciate your interest in a demonstration of persisting employee data in a simple store. I'm planning to cover topics like data persistence and storage in an upcoming video.

  • @AsifHussain2847
    @AsifHussain2847 6 месяцев назад +1

    how to get source code

    • @CodingDroplets
      @CodingDroplets  6 месяцев назад +1

      github.com/codingdroplets/MauiMvvmDemo

  • @hananehanane4881
    @hananehanane4881 9 месяцев назад +1

    You don't share the code 😢

    • @CodingDroplets
      @CodingDroplets  9 месяцев назад

      I appreciate your interest! The source code for the .NET MAUI MVVM tutorial is available on GitHub. You can find it at the following repository:
      github.com/codingdroplets/MauiMvvmDemo

    • @hananehanane4881
      @hananehanane4881 9 месяцев назад +1

      thank you @@CodingDroplets🙂

    • @CodingDroplets
      @CodingDroplets  9 месяцев назад

      You are very welcome!

    • @hananehanane4881
      @hananehanane4881 9 месяцев назад

      how can i select or click on label on collectionview please ?@@CodingDroplets

    • @CodingDroplets
      @CodingDroplets  9 месяцев назад

      Are you using Frame inside CollectionView item?

  • @DerykRobosson
    @DerykRobosson 8 месяцев назад +2

    There was nothing "deep" about that "dive".

    • @CodingDroplets
      @CodingDroplets  8 месяцев назад

      Thank you for sharing your feedback!

    • @mohsenmosahebifrad8939
      @mohsenmosahebifrad8939 7 месяцев назад +3

      That's not true. This video is short because tutor did not wasting time by slow typing, correcting errors and obssession with naming convetions. He prepared everything beforhand and cut useless section from his videos.