Customizing Controls with Handlers in .NET MAUI

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ส.ค. 2024
  • NOTE: The code shown in this video is not working anymore. See updated video here: • .NET MAUI: Customize C...
    UI controls in .NET MAUI are rendered via handlers, lightweight classes that map properties and features to bite-sized implementations. In this video we will learn how to override the default .NET MAUI handler behavior to tweak the native controls to our liking. Spoiler alert: much easier than Xamarin.Forms Custom Renderers!
    💝 Join this channel to get access to perks:
    th-cam.com/channels/ral.html...
    🛑 Don't forget to subscribe to my channel for more amazing content: th-cam.com/users/GeraldVerslui...
    🐦 Follow me on Twitter: / jfversluis
    🤝 Join the Discord server: / discord
    🔗 Links
    Sample App Repo: github.com/jfversluis/MAUICus...
    Javier .NET MAUI Conversion Samples Repo: github.com/jsuarezruiz/xamari...
    .NET MAUI Docs: docs.microsoft.com/dotnet/maui
    .NET MAUI Repo: github.com/dotnet/maui
    ⏱ Timestamps
    00:00 - Intro
    00:12 - Inspect End Result
    00:31 - Implement Custom Handler for All Views
    06:09 - Custom Handlers for Multiple Platforms
    07:23 - Running the Sample App
    07:55 - Customize Specific Control: Button
    09:51 - Customize Controls Without if compiler directives
    11:53 - Why (Not) Use This Method
    12:25 - Customize Controls with Partial Classes
    17:53 - Outro
    🎥 Video edited with Camtasia (ref): techsmith.z6rjha.net/AJoeD
    🙋‍♂️ Also find my...
    Twitter: / jfversluis
    Blog: blog.verslu.is
    Twitch: / jfversluis
    All the rest: jfversluis.dev
    #dotnetmaui #Handlers #Customize #dotnet #dotnet6 #XamarinForms #CustomRenderer #Renderers #CustomHandler
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    !!! Please note that the code in this video does not work any more !!! Please see this updated video: th-cam.com/video/k6Zk3Ho8YNw/w-d-xo.html

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

      Thanks for all the video updates to your Tutorials and Examples as MAUI Progresses

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

    You’re a life saver. Whenever I think I need something, I can always count on learning it quick knowing you probably have a tutorial for it!

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

      Thank you Shahan! 🥰

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

    Awesome video, thank you! I hope we'll learn more about Shells in Maui.

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

      Good one! I should do more with Shell and .NET MAUI is a great point in time to do so, I will look into it!

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

    Thanks Gerald for answering my question 👍. You're the man.

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

      No problem 👍 Thanks!

  • @SurinderSingh-ue9ft
    @SurinderSingh-ue9ft 2 ปีที่แล้ว

    Hi Gerald, Its an much needed video from you with clear presentation of handlers in MAUI, please go for custom controls video as well, Thanks

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

    Thanks, looking forward for more

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

    I like Method 3. Awesome video . Keep them rolling. Thanks.

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

      Me too! Looking forward to someone coming up with an even better solution though :D

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

    Great video and of course i get more videos about custom handlers !
    Thank you !

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

      More will come, thank you!

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

      And thanks for becoming a member! Super appreciate it!

  • @MuhammadNadeem-wj6xd
    @MuhammadNadeem-wj6xd 3 ปีที่แล้ว +1

    Wow.... @Gerald is Back 🥳

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

      Wait, was I gone?! :o

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

    Wonderful. Very useful.

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

    Very nice video.
    I like to see something about Custom Controls

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

      Thanks! It's coming! :)

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

    Custom Controls for MAUI Please !!! :)

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

      Definitely coming!

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

      Yes

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

    Thank you for this great video. Do you plan to do one on the MVU pattern in MAUI ? And/Or the declarative way to write UI with C#forMarkup or Comet ?
    I am currently a .NET developer but more backend. In my free time I use Flutter to develop some mobile app for personal use and I really like their approach but as it seems that it exists kind of a same way to do it with .NET, I am considering the possibility to use MAUI for my next apps. Of course I can do it in MVVM but I find MVU more interesting for my little apps.
    Anyway, keep up the good work, you're doing it great !

  • @jean-baptistedioli1692
    @jean-baptistedioli1692 2 หลายเดือนก่อน

    Thanks for the awesome video!
    I'm also interested in creating our own control, for example to create a new button style from scratch. :)

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

    WOW WELCOME MAUI ♥

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

      Expect a lot more to come! :)

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

    Thanks for the video,
    How to handle Xamarin.Forms Dependency service & Effects in MAUI

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

      Those will both come, thanks!

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

    Hello Gerald, do you know if MAUI will have direct support of SVG images ? I've been using fonts for that case in XF, which is not ideal for every use case.

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

      It will support SVGs out of the box!

  • @abdulkabir_02
    @abdulkabir_02 5 หลายเดือนก่อน

    Awesome video as always, can you make another video related to custom Button in tabbedpage ?

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

    Having a video explaining how to create custom controls would be great

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

      The actual custom control is a bit hard because that is whatever you want to implement. I do have this: th-cam.com/video/cbmoaD-PDtA/w-d-xo.html which should mostly be the same for .NET MAUI :)

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

    Hi, Gerald! I've just found your videos and they are amazing!
    Could you please make a video about how to transform classic Xamarin.Forms custom render to .Net MAUI handler?
    If I have a bunch of custom renderers in my app, how should I remake them to handlers?
    Thanks in advance!

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

      Thanks Anton! Appreciate it! That will definitely come :)

  • @ankits9791
    @ankits9791 5 หลายเดือนก่อน

    Hi, I want to creat custom datagridListview handler to handle scrollchange event. Do you have any idea how to do that? Please help

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

    Great. It was so cool, I try to learn Xamarin one month ago, as you describe about MAUI its better to start learning MAUI not xamarin form in old way?
    and, Is that a good way to start new App with MAUI or i must wait for release final version?

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

      It depends... If you want to start learning I would recommend Xamarin.Forms today. 90% what you learn about Forms will be applicable to .NET MAUI as well and it's a bit more stable at the time being. For a new app that you want to release to production... If you really want to start today; again Forms is the better option. If you can wait a. couple of months, definitely .NET MAUI. But there will be a transition possible from Forms to .NET MAUI so if you do start today in Forms, the transition should be relatively easy :)
      Also this video might help: th-cam.com/video/zvPPz6DABi8/w-d-xo.html

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

    I quickly tried all three methods in a new project except I used the Entry control and removed the underline. All three methods worked fine. The sample code is under robreno forward slash CustomControlHandlerDemo. I found the 3rd method very nice, but am left with a question. It works, but is this not the recommended way any longer or are there issues to be concerned about? Thanks for this video, Gerald.

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

    Thanks 👍

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

    Its a great video. Just one question as it seems if we define the handler it will override the view property as whole what if we need different customize at different pages?

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

      Thanks! You can write your own logic to handle the property. So either fix it with logic or create inheritances of the different controls and customize those separately :)

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

    How do you do it for CollectionView? before, in xamarin I used to extend CollectionViewRenderer in Android and IOS projects.

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

      Found it Microsoft.Maui.Controls.Handlers.Items.CollectionViewHandler

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

    Gerald, Could you talk about release Xamarin Forms/MAUI apps automatically to App/Play Store using Azure DevOps?

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

      I'll add it to the list!

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

    Gerald, I hope you talk about how to make the design responsive for mobile and tablet in Xamarin Forms.

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

      Maybe in the future, probably not soon :) need to see some more of .NET MAUI for that first

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

    Indeed Handlers are far better than Renderers, time to upgrade all of my renderers to handlers :)

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

    Can we use xaml/wpf controls in maui.or only specified controls in maui

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

      Just .NET MAUI controls, which you can use from XAML

  • @stefanhodges-kluck5580
    @stefanhodges-kluck5580 2 ปีที่แล้ว +1

    Thanks for these videos! I am trying to implement this, and as of Version 17.0.0 Preview 7.0 of VS 2022, getting a message that "ButtonMapper does not exist on property ButtonHandler." "ElementHandler" property does exist, but that gives error, "Cannot apply indexing with [] to an expression of type 'IPropertyMapper'."

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

      Seems there has been a change in that area already... I should make an updated video I guess 😅

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

      @@jfversluis Please make one. I can't seem to find anywhere how to use the "updated" version of this, even the official docs are wrong :/

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

      Remember it’s all preview. I understand it can be frustrating but things change :)

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

      See here for more info: twitter.com/jfversluis/status/1463886879703633930?s=21
      I’ll post an updated video soon :)

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

    Another great video. How could I use this to change the status bar background and text color ifor windows?

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

      You mean the title bar? The top one with the close and minimize buttons?

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

      @@jfversluis Yes. Toolkit behaviors only seems to work for android and iOS Title Bars.

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

      Have you been able to figure it out yet?

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

    To be honest I didn't get why the button's background been updated? It seems Gerald has overwritten "MyCustomization" property. Why is this delegate been called. Do we have MyCustomization bindable property somewhere?

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

      That's what I mentioned. If you're overriding it like this the property name doesn't matter, it will call it anyway :)

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

    Very nice to globally set few things

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

      It sure is! Much easier than a custom renderer :)

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

    how to disable softkeyboard, drawing line using skiasharp canvas, getcursor position of Entry, create pdf using pdfSharp using Maui

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

    hello ,i want to add a keydown event for Entry,and do some work Commandexecute,also remove the underline,could you give a video,i have see this video 3 method about handler,its prettey good.anther,Render is also could be used in Maui,are you intersting do some video Maui Render?thansk

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

    This implementation won't work when I download the latest update.

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

      WHAT! This is already obsolete?! :D What doesn't work exactly?

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

    He's using Android.Graphics.Color.Red around 8:02, but I think the more appropriate way to define colors would be to use the Maui package so it can be used universally; e.g. Microsoft.Maui.Graphics.Colors.Red.ToNative();

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

      Absolutely! Just sample code :)

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

      @@jfversluis Just letting the other viewers know as well :)

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

    Hi Gerald. I tried to run .net Maui in UWP but it failed to execute.

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

      Without any details it's pretty hard to say something useful about it :)

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

      @@jfversluis can you please show us a blog of the .net Maui running in UWP? We duly appreciated if you let us see the sample. Thank you

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

      @@robertojrcantos1711 I don’t know what to tell you. For me it just works :)

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

      @@jfversluis would please show us some example of .net Maui running UWP. To see is to believe.

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

      I don’t think i have to prove anything and besides; why would I lie? Like I said; if you share some more details about what you’re seeing then I can maybe offer some assistance. I don’t think it’s very helpful that I show you how it’s running on my machine without any issues.

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

    Custom controls please

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

      Will work on it!