Skip to content

Instantly share code, notes, and snippets.

View sthewissen's full-sized avatar
🤷‍♂️
Developing tings.

Steven Thewissen sthewissen

🤷‍♂️
Developing tings.
View GitHub Profile
var builder = MauiApp.CreateBuilder(); builder.UseMauiApp<App>()
#if __ANDROID__
.ConfigureMauiHandlers(handlers =>
{
handlers.AddCompatibilityRenderer(typeof(Microsoft.Maui.Controls.BoxView), typeof(MyBoxRenderer));
#endif
});
return builder;
#if __ANDROID__
Microsoft.Maui.Handlers.ButtonHandler.ButtonMapper["MyCustomization"] = (handler, view) =>
{
handler.NativeView.SetBackgroundColor(Android.Graphics.Color.Green);
};
#endif
}
}
using Microsoft.Maui;
using Microsoft.Maui.Hosting;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
using Microsoft.Maui;
using Microsoft.Maui.Controls;
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new MainPage();
}
using Microsoft.Maui;
using Microsoft.Maui.Hosting;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
public static void MapText(MyButtonHandler handler, IMyButton button)
{
handler.NativeView?.SetTitle(button.Text, UIControlState.Normal);
}
public static PropertyMapper<IMyButton, MyButtonHandler> MyButtonMapper = new PropertyMapper<IMyButton, MyButtonHandler >(ViewHandler.ViewMapper)
{
[nameof(ICustomEntry.Text)] = MapText,
[nameof(ICustomEntry.TextColor)] = MapTextColor
};
protected override UIButton CreateNativeView()
{
return new UIButton();
}
public partial class MyButtonHandler :
ViewHandler<IMyButton, UIButton>
{
}