From e50f9c25b7bef2f818b000a7ab8da08c65d72886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20=C3=96man?= Date: Mon, 18 Aug 2025 08:35:23 +0200 Subject: [PATCH] Switches Radiobuttons --- AdventureWorks.MAUI/MauiProgram.cs | 16 +++++++++++ AdventureWorks.MAUI/Views/UserDetailView.xaml | 27 ++++++++++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/AdventureWorks.MAUI/MauiProgram.cs b/AdventureWorks.MAUI/MauiProgram.cs index 22c06e3..6658fcd 100644 --- a/AdventureWorks.MAUI/MauiProgram.cs +++ b/AdventureWorks.MAUI/MauiProgram.cs @@ -21,6 +21,7 @@ namespace AdventureWorks.MAUI #if WINDOWS SetWindowOptions(builder); + SetWindowHandlers(); #endif #if DEBUG @@ -53,5 +54,20 @@ namespace AdventureWorks.MAUI }); } #endif +#if WINDOWS + public static void SetWindowHandlers() + { + // Customize the Switch control for Windows + Microsoft.Maui.Handlers.SwitchHandler.Mapper + .AppendToMapping("Custom", (h,v) => + { + h.PlatformView.OffContent = "No"; + h.PlatformView.OnContent = "Yes"; + + h.PlatformView.MinWidth = 0; + }); + } +#endif + } } diff --git a/AdventureWorks.MAUI/Views/UserDetailView.xaml b/AdventureWorks.MAUI/Views/UserDetailView.xaml index d2affd9..084a753 100644 --- a/AdventureWorks.MAUI/Views/UserDetailView.xaml +++ b/AdventureWorks.MAUI/Views/UserDetailView.xaml @@ -7,7 +7,7 @@ - @@ -66,10 +66,31 @@ - + +