Maui controls handlers learning

Haviv Elbsz 2,071 Reputation points
2024-05-23T10:16:10.72+00:00

Hello All. I'm trying to learn how to customize android control. I know the concept of the customizing but my difficult is where I can find learning stuff of the android side what I mean is in the example below where I can find the section that start with .SetBackground Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("BoderlessEntry", (handler, view) => { #if ANDROID handler.PlatformView.SetBackgroundColor(Microsoft.Maui.Graphics.Colors.Transparent.ToAndroid()); #elif IOS

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,232 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 61,731 Reputation points
    2024-05-23T16:03:06.6533333+00:00

    its basically black magic. the customization passes the "wrapped" native instance. the wrapped instance has c# methods generated from the native toolkit. so basically you need to know what native UI object would be passed, and the native object properties (see android java or IOS UIKit documentation). intellisense supplies the rest.

    you can read the source code to better understand, or just google for solutions.

    0 comments No comments

  2. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 29,456 Reputation points Microsoft Vendor
    2024-05-29T02:58:49.36+00:00

    Hello,

    I notice that you are using EntryHandler, there is a table that lists the types that implement views in .NET MAUI, please see .NET MAUI handlers - .NET MAUI | Microsoft Learn

    From the source code, you can see the PlatformView is type of MauiAppCompatEditText, and it's extended from AppCompatEditText. About this native Android control, you could refer to AppCompatEditText | Android Developers

    There is no such .NET-Android documentation so far, the missing documents are being collected and sorted. And you could rise an issue at https://github.com/dotnet/docs-maui to tell them your concerns, they will evaluate your needs carefully.

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments