├── images ├── mvp-summit.jpg ├── custom-handler.png └── custom-renderer.png ├── src ├── Xamarin.Forms │ ├── Library.Sample │ │ ├── Library.Sample │ │ │ ├── AssemblyInfo.cs │ │ │ ├── App.xaml │ │ │ ├── MainPage.xaml.cs │ │ │ ├── App.xaml.cs │ │ │ ├── Library.Sample.csproj │ │ │ └── MainPage.xaml │ │ ├── Library.Sample.iOS │ │ │ ├── Resources │ │ │ │ ├── Default.png │ │ │ │ ├── Default@2x.png │ │ │ │ ├── Default-568h@2x.png │ │ │ │ ├── Default-Portrait.png │ │ │ │ ├── Default-Portrait@2x.png │ │ │ │ └── LaunchScreen.storyboard │ │ │ ├── Assets.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── Icon20.png │ │ │ │ │ ├── Icon29.png │ │ │ │ │ ├── Icon40.png │ │ │ │ │ ├── Icon58.png │ │ │ │ │ ├── Icon60.png │ │ │ │ │ ├── Icon76.png │ │ │ │ │ ├── Icon80.png │ │ │ │ │ ├── Icon87.png │ │ │ │ │ ├── Icon1024.png │ │ │ │ │ ├── Icon120.png │ │ │ │ │ ├── Icon152.png │ │ │ │ │ ├── Icon167.png │ │ │ │ │ ├── Icon180.png │ │ │ │ │ └── Contents.json │ │ │ ├── Entitlements.plist │ │ │ ├── Main.cs │ │ │ ├── AppDelegate.cs │ │ │ ├── Info.plist │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ └── Library.Sample.iOS.csproj │ │ └── Library.Sample.Android │ │ │ ├── Resources │ │ │ ├── mipmap-hdpi │ │ │ │ ├── icon.png │ │ │ │ └── launcher_foreground.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── icon.png │ │ │ │ └── launcher_foreground.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── icon.png │ │ │ │ └── launcher_foreground.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── icon.png │ │ │ │ └── launcher_foreground.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── icon.png │ │ │ │ └── launcher_foreground.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── icon.xml │ │ │ │ └── icon_round.xml │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ └── AboutResources.txt │ │ │ ├── Properties │ │ │ ├── AndroidManifest.xml │ │ │ └── AssemblyInfo.cs │ │ │ ├── Assets │ │ │ └── AboutAssets.txt │ │ │ ├── MainActivity.cs │ │ │ └── Library.Sample.Android.csproj │ ├── Library │ │ ├── Effects │ │ │ ├── FocusRoutingEffect.shared.cs │ │ │ ├── FocusRoutingEffectImpl.ios.cs │ │ │ └── FocusRoutingEffectImpl.android.cs │ │ ├── Renderers │ │ │ ├── CharacterSpacingExtensions.android.cs │ │ │ ├── CustomEntryRenderer.ios.cs │ │ │ ├── ColorStateListExtensions.android.cs │ │ │ ├── TextAlignmentExtensions.android.cs │ │ │ ├── CustomEntry.shared.cs │ │ │ └── CustomEntryRenderer.android.cs │ │ ├── Triggers │ │ │ └── NumericValidationTriggerAction.shared.cs │ │ ├── Converters │ │ │ └── IntToBoolConverter.shared.cs │ │ ├── Behaviors │ │ │ └── NumericValidationBehavior.shared.cs │ │ └── Library.csproj │ └── Library.sln └── .NET MAUI │ └── Library │ ├── Library │ ├── Effects │ │ ├── PlatformFocusPlatformEffect.Standard.cs │ │ └── FocusRoutingEffect.cs │ ├── Platforms │ │ ├── Android │ │ │ ├── CharacterSpacingExtensions.cs │ │ │ ├── ColorStateListExtensions.cs │ │ │ ├── TextAlignmentExtensions.cs │ │ │ ├── CustomEntryExtensions.cs │ │ │ ├── CustomEntryHandler.cs │ │ │ └── CustomEntryRenderer.cs │ │ ├── Windows │ │ │ ├── CustomEntryRenderer.cs │ │ │ └── CustomEntryHandler.cs │ │ ├── iOS │ │ │ ├── CustomEntryRenderer.cs │ │ │ └── CustomEntryHandler.cs │ │ └── MacCatalyst │ │ │ ├── CustomEntryRenderer.cs │ │ │ └── CustomEntryHandler.cs │ ├── Triggers │ │ └── NumericValidationTriggerAction.cs │ ├── Converters │ │ └── IntToBoolConverter.cs │ ├── Controls │ │ ├── ICustomEntry.cs │ │ └── CustomEntry.cs │ ├── Behaviors │ │ └── NumericValidationBehavior.cs │ ├── Handlers │ │ ├── CustomEntryMapper.Standard.cs │ │ └── CustomEntryHandler.cs │ ├── Library.csproj │ └── Hosting │ │ └── AppHostBuilderExtensions.cs │ ├── Library.Sample │ ├── Properties │ │ └── launchSettings.json │ ├── Resources │ │ ├── Fonts │ │ │ ├── OpenSans-Regular.ttf │ │ │ └── OpenSans-Semibold.ttf │ │ ├── appicon.svg │ │ ├── Raw │ │ │ └── AboutAssets.txt │ │ ├── appiconfg.svg │ │ ├── Images │ │ │ └── dotnet_bot.svg │ │ └── Styles.xaml │ ├── AppShell.xaml.cs │ ├── MainPage.xaml.cs │ ├── App.xaml.cs │ ├── Platforms │ │ ├── Android │ │ │ ├── Resources │ │ │ │ └── values │ │ │ │ │ └── colors.xml │ │ │ ├── AndroidManifest.xml │ │ │ ├── MainActivity.cs │ │ │ └── MainApplication.cs │ │ ├── iOS │ │ │ ├── AppDelegate.cs │ │ │ ├── Program.cs │ │ │ └── Info.plist │ │ ├── MacCatalyst │ │ │ ├── AppDelegate.cs │ │ │ ├── Program.cs │ │ │ └── Info.plist │ │ └── Windows │ │ │ ├── App.xaml │ │ │ ├── app.manifest │ │ │ ├── App.xaml.cs │ │ │ └── Package.appxmanifest │ ├── App.xaml │ ├── AppShell.xaml │ ├── MauiProgram.cs │ ├── Library.Sample.csproj │ └── MainPage.xaml │ ├── Library.sln │ └── Library.MultiTargeting.targets ├── .gitattributes └── .gitignore /images/mvp-summit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/images/mvp-summit.jpg -------------------------------------------------------------------------------- /images/custom-handler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/images/custom-handler.png -------------------------------------------------------------------------------- /images/custom-renderer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/images/custom-renderer.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms.Xaml; 2 | 3 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Effects/PlatformFocusPlatformEffect.Standard.cs: -------------------------------------------------------------------------------- 1 | namespace Library.Effects 2 | { 3 | public class PlatformFocusPlatformEffect 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Windows Machine": { 4 | "commandName": "MsixPackage", 5 | "nativeDebugging": false 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Resources/Fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/.NET MAUI/Library/Library.Sample/Resources/Fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Resources/Fonts/OpenSans-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/.NET MAUI/Library/Library.Sample/Resources/Fonts/OpenSans-Semibold.ttf -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-hdpi/icon.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xhdpi/icon.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xxxhdpi/icon.png -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/AppShell.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Library.Sample 2 | { 3 | public partial class AppShell : Shell 4 | { 5 | public AppShell() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Library.Sample 2 | { 3 | public partial class MainPage : ContentPage 4 | { 5 | public MainPage() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jsuarezruiz/mvpsummit2022-dotnet-maui/HEAD/src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Resources/appicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Library.Sample 2 | { 3 | public partial class App : Application 4 | { 5 | public App() 6 | { 7 | InitializeComponent(); 8 | 9 | MainPage = new AppShell(); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #512BD4 4 | #2B0B98 5 | #2B0B98 6 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Effects/FocusRoutingEffect.shared.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | 3 | namespace Library.Effects 4 | { 5 | public class FocusRoutingEffect : RoutingEffect 6 | { 7 | public FocusRoutingEffect() : base("Effects.FocusEffect") 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | 3 | namespace Library.Sample 4 | { 5 | [Register("AppDelegate")] 6 | public class AppDelegate : MauiUIApplicationDelegate 7 | { 8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 9 | } 10 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/MacCatalyst/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | 3 | namespace Library.Sample 4 | { 5 | [Register("AppDelegate")] 6 | public class AppDelegate : MauiUIApplicationDelegate 7 | { 8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 9 | } 10 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample/App.xaml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-anydpi-v26/icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #3F51B5 5 | #303F9F 6 | #FF4081 7 | 8 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/mipmap-anydpi-v26/icon_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/Android/CharacterSpacingExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Library.Extensions.Android 2 | { 3 | public static class CharacterSpacingExtensions 4 | { 5 | public const float EmCoefficient = 0.0624f; 6 | 7 | public static float ToEm(this double pt) 8 | { 9 | return (float)pt * EmCoefficient; //Coefficient for converting Pt to Em 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Renderers/CharacterSpacingExtensions.android.cs: -------------------------------------------------------------------------------- 1 | namespace Library.Extensions.Android 2 | { 3 | public static class CharacterSpacingExtensions 4 | { 5 | public const float EmCoefficient = 0.0624f; 6 | 7 | public static float ToEm(this double pt) 8 | { 9 | return (float)pt * EmCoefficient; //Coefficient for converting Pt to Em 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/Windows/App.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Triggers/NumericValidationTriggerAction.cs: -------------------------------------------------------------------------------- 1 | namespace Library.Triggers 2 | { 3 | public class NumericValidationTriggerAction : TriggerAction 4 | { 5 | protected override void Invoke(Entry entry) 6 | { 7 | bool isValid = double.TryParse(entry.Text, out double result); 8 | entry.TextColor = isValid ? Colors.Black : Colors.Red; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Triggers/NumericValidationTriggerAction.shared.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | 3 | namespace Library.Triggers 4 | { 5 | public class NumericValidationTriggerAction : TriggerAction 6 | { 7 | protected override void Invoke(Entry entry) 8 | { 9 | bool isValid = double.TryParse(entry.Text, out double result); 10 | entry.TextColor = isValid ? Color.Default : Color.Red; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Xamarin.Forms; 8 | 9 | namespace Library.Sample 10 | { 11 | public partial class MainPage : ContentPage 12 | { 13 | public MainPage() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/App.xaml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/AppShell.xaml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Content.PM; 3 | using Android.OS; 4 | 5 | namespace Library.Sample 6 | { 7 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] 8 | public class MainActivity : MauiAppCompatActivity 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/iOS/Program.cs: -------------------------------------------------------------------------------- 1 | using ObjCRuntime; 2 | using UIKit; 3 | 4 | namespace Library.Sample 5 | { 6 | public class Program 7 | { 8 | // This is the main entry point of the application. 9 | static void Main(string[] args) 10 | { 11 | // if you want to use a different Application Delegate class from "AppDelegate" 12 | // you can specify it here. 13 | UIApplication.Main(args, null, typeof(AppDelegate)); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/MacCatalyst/Program.cs: -------------------------------------------------------------------------------- 1 | using ObjCRuntime; 2 | using UIKit; 3 | 4 | namespace Library.Sample 5 | { 6 | public class Program 7 | { 8 | // This is the main entry point of the application. 9 | static void Main(string[] args) 10 | { 11 | // if you want to use a different Application Delegate class from "AppDelegate" 12 | // you can specify it here. 13 | UIApplication.Main(args, null, typeof(AppDelegate)); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Converters/IntToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | namespace Library.Converters 4 | { 5 | public class IntToBoolConverter : IValueConverter 6 | { 7 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 8 | { 9 | return (int)value != 0; 10 | } 11 | 12 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | return (bool)value ? 1 : 0; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Resources/Raw/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "MauiAsset": 3 | 4 | 5 | 6 | These files will be deployed with you package and will be accessible using Essentials: 7 | 8 | async Task LoadMauiAsset() 9 | { 10 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); 11 | using var reader = new StreamReader(stream); 12 | 13 | var contents = reader.ReadToEnd(); 14 | } 15 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Converters/IntToBoolConverter.shared.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using Xamarin.Forms; 4 | 5 | namespace Library.Converters 6 | { 7 | public class IntToBoolConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | return (int)value != 0; 12 | } 13 | 14 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | return (bool)value ? 1 : 0; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Controls/ICustomEntry.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui; 2 | using Microsoft.Maui.Graphics; 3 | 4 | namespace Library.Controls 5 | { 6 | public interface ICustomEntry : IView 7 | { 8 | public string Text { get; } 9 | public Color TextColor { get; } 10 | public string Placeholder { get; } 11 | public Color PlaceholderColor { get; } 12 | public double CharacterSpacing { get; } 13 | public TextAlignment HorizontalTextAlignment { get; } 14 | public TextAlignment VerticalTextAlignment { get; } 15 | 16 | void SendCompleted(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace Library.Sample.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, typeof(AppDelegate)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using Xamarin.Forms.Xaml; 4 | 5 | namespace Library.Sample 6 | { 7 | public partial class App : Application 8 | { 9 | public App() 10 | { 11 | InitializeComponent(); 12 | 13 | MainPage = new MainPage(); 14 | } 15 | 16 | protected override void OnStart() 17 | { 18 | } 19 | 20 | protected override void OnSleep() 21 | { 22 | } 23 | 24 | protected override void OnResume() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/Windows/CustomEntryRenderer.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Library.Renderers.Windows; 3 | using Microsoft.Maui.Controls.Compatibility; 4 | using Microsoft.Maui.Controls.Compatibility.Platform.UWP; 5 | using Microsoft.Maui.Controls.Platform; 6 | 7 | [assembly: ExportRenderer(typeof(CustomEntry), typeof(CustomEntryRenderer))] 8 | namespace Library.Renderers.Windows 9 | { 10 | public class CustomEntryRenderer : EntryRenderer 11 | { 12 | protected override void OnElementChanged(ElementChangedEventArgs e) 13 | { 14 | base.OnElementChanged(e); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/Android/MainApplication.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Runtime; 3 | using Library.Handlers; 4 | 5 | namespace Library.Sample 6 | { 7 | [Application] 8 | public class MainApplication : MauiApplication 9 | { 10 | public MainApplication(IntPtr handle, JniHandleOwnership ownership) 11 | : base(handle, ownership) 12 | { 13 | /* 14 | CustomEntryHandler.CustomEntryMapper.Add("RemoveBorder", (h, w) => 15 | { 16 | h.PlatformView.Background = null; 17 | }); 18 | */ 19 | } 20 | 21 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with your package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample/Library.Sample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | 7 | 8 | 9 | portable 10 | true 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Renderers/CustomEntryRenderer.ios.cs: -------------------------------------------------------------------------------- 1 | using Renderers; 2 | using Renderers.iOS.Renderers; 3 | using UIKit; 4 | using Xamarin.Forms; 5 | using Xamarin.Forms.Platform.iOS; 6 | 7 | [assembly: ExportRenderer(typeof(CustomEntry), typeof(CustomEntryRenderer))] 8 | namespace Library.Renderers.iOS 9 | { 10 | public class CustomEntryRenderer : EntryRenderer 11 | { 12 | protected override void OnElementChanged(ElementChangedEventArgs e) 13 | { 14 | base.OnElementChanged(e); 15 | 16 | if (Control != null) 17 | { 18 | Control.BackgroundColor = UIColor.FromRGB(204, 153, 255); 19 | Control.BorderStyle = UITextBorderStyle.Line; 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/Windows/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | true/PM 12 | PerMonitorV2, PerMonitor 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Behaviors/NumericValidationBehavior.cs: -------------------------------------------------------------------------------- 1 | namespace Library.Behaviors 2 | { 3 | public class NumericValidationBehavior : Behavior 4 | { 5 | protected override void OnAttachedTo(Entry entry) 6 | { 7 | entry.TextChanged += OnEntryTextChanged; 8 | base.OnAttachedTo(entry); 9 | } 10 | 11 | protected override void OnDetachingFrom(Entry entry) 12 | { 13 | entry.TextChanged -= OnEntryTextChanged; 14 | base.OnDetachingFrom(entry); 15 | } 16 | 17 | void OnEntryTextChanged(object sender, TextChangedEventArgs args) 18 | { 19 | bool isValid = double.TryParse(args.NewTextValue, out double result); 20 | ((Entry)sender).TextColor = isValid ? Colors.Black : Colors.Red; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/iOS/CustomEntryRenderer.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Library.Renderers.iOS; 3 | using Microsoft.Maui.Controls.Compatibility; 4 | using Microsoft.Maui.Controls.Compatibility.Platform.iOS; 5 | using Microsoft.Maui.Controls.Platform; 6 | using UIKit; 7 | 8 | [assembly: ExportRenderer(typeof(CustomEntry), typeof(CustomEntryRenderer))] 9 | namespace Library.Renderers.iOS 10 | { 11 | public class CustomEntryRenderer : EntryRenderer 12 | { 13 | protected override void OnElementChanged(ElementChangedEventArgs e) 14 | { 15 | base.OnElementChanged(e); 16 | 17 | if (Control != null) 18 | { 19 | Control.BackgroundColor = UIColor.FromRGB(204, 153, 255); 20 | Control.BorderStyle = UITextBorderStyle.Line; 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/MacCatalyst/CustomEntryRenderer.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Library.Renderers.Mac; 3 | using Microsoft.Maui.Controls.Compatibility; 4 | using Microsoft.Maui.Controls.Compatibility.Platform.iOS; 5 | using Microsoft.Maui.Controls.Platform; 6 | using UIKit; 7 | 8 | [assembly: ExportRenderer(typeof(CustomEntry), typeof(CustomEntryRenderer))] 9 | namespace Library.Renderers.Mac 10 | { 11 | public class CustomEntryRenderer : EntryRenderer 12 | { 13 | protected override void OnElementChanged(ElementChangedEventArgs e) 14 | { 15 | base.OnElementChanged(e); 16 | 17 | if (Control != null) 18 | { 19 | Control.BackgroundColor = UIColor.FromRGB(204, 153, 255); 20 | Control.BorderStyle = UITextBorderStyle.Line; 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Behaviors/NumericValidationBehavior.shared.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | 3 | namespace Library.Behaviors 4 | { 5 | public class NumericValidationBehavior : Behavior 6 | { 7 | protected override void OnAttachedTo(Entry entry) 8 | { 9 | entry.TextChanged += OnEntryTextChanged; 10 | base.OnAttachedTo(entry); 11 | } 12 | 13 | protected override void OnDetachingFrom(Entry entry) 14 | { 15 | entry.TextChanged -= OnEntryTextChanged; 16 | base.OnDetachingFrom(entry); 17 | } 18 | 19 | void OnEntryTextChanged(object sender, TextChangedEventArgs args) 20 | { 21 | bool isValid = double.TryParse(args.NewTextValue, out double result); 22 | ((Entry)sender).TextColor = isValid ? Color.Default : Color.Red; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/Android/ColorStateListExtensions.cs: -------------------------------------------------------------------------------- 1 | using Android.Content.Res; 2 | using AColor = Android.Graphics.Color; 3 | 4 | namespace Library.Extensions.Android 5 | { 6 | internal static class ColorStateListExtensions 7 | { 8 | public static bool IsOneColor( 9 | this ColorStateList csl, 10 | int[][] ColorStates, 11 | AColor color) 12 | { 13 | if (csl == null) 14 | return false; 15 | 16 | if (ColorStates.Length == 0) 17 | return false; 18 | 19 | for (int i = 0; i < ColorStates.Length; i++) 20 | { 21 | var colorState = ColorStates[i]; 22 | if (csl.GetColorForState(colorState, color) != color) 23 | return false; 24 | } 25 | 26 | return true; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Renderers/ColorStateListExtensions.android.cs: -------------------------------------------------------------------------------- 1 | using Android.Content.Res; 2 | using AColor = Android.Graphics.Color; 3 | 4 | namespace Library.Extensions.Android 5 | { 6 | internal static class ColorStateListExtensions 7 | { 8 | public static bool IsOneColor( 9 | this ColorStateList? csl, 10 | int[][] ColorStates, 11 | AColor color) 12 | { 13 | if (csl == null) 14 | return false; 15 | 16 | if (ColorStates.Length == 0) 17 | return false; 18 | 19 | for (int i = 0; i < ColorStates.Length; i++) 20 | { 21 | var colorState = ColorStates[i]; 22 | if (csl.GetColorForState(colorState, color) != color) 23 | return false; 24 | } 25 | 26 | return true; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/Windows/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.UI.Xaml; 2 | 3 | // To learn more about WinUI, the WinUI project structure, 4 | // and more about our project templates, see: http://aka.ms/winui-project-info. 5 | 6 | namespace Library.Sample.WinUI 7 | { 8 | /// 9 | /// Provides application-specific behavior to supplement the default Application class. 10 | /// 11 | public partial class App : MauiWinUIApplication 12 | { 13 | /// 14 | /// Initializes the singleton application object. This is the first line of authored code 15 | /// executed, and as such is the logical equivalent of main() or WinMain(). 16 | /// 17 | public App() 18 | { 19 | this.InitializeComponent(); 20 | } 21 | 22 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/MauiProgram.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Library.Effects; 3 | using Library.Hosting; 4 | using Microsoft.Maui.Controls.Compatibility.Hosting; 5 | 6 | namespace Library.Sample 7 | { 8 | public static class MauiProgram 9 | { 10 | public static MauiApp CreateMauiApp() 11 | { 12 | var builder = MauiApp.CreateBuilder(); 13 | 14 | builder 15 | .UseMauiApp() 16 | .ConfigureLibrary() 17 | /* 18 | .ConfigureEffects(effects => 19 | { 20 | effects.Add(typeof(FocusRoutingEffect), typeof(PlatformFocusPlatformEffect)); 21 | }) 22 | .ConfigureMauiHandlers(handlers => 23 | { 24 | #if __ANDROID__ 25 | handlers.AddCompatibilityRenderer(typeof(CustomEntry), typeof(Renderers.Android.CustomEntryRenderer)); 26 | #endif 27 | }) 28 | */; 29 | 30 | return builder.Build(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Handlers/CustomEntryMapper.Standard.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Microsoft.Maui.Handlers; 3 | 4 | namespace Library.Handlers 5 | { 6 | public partial class CustomEntryHandler : ViewHandler 7 | { 8 | protected override object CreatePlatformView() => throw new NotImplementedException(); 9 | 10 | public static void MapText(CustomEntryHandler handler, ICustomEntry entry) { } 11 | 12 | public static void MapTextColor(CustomEntryHandler handler, ICustomEntry entry) { } 13 | 14 | public static void MapPlaceholder(CustomEntryHandler handler, ICustomEntry entry) { } 15 | 16 | public static void MapPlaceholderColor(CustomEntryHandler handler, ICustomEntry entry) { } 17 | 18 | public static void MapCharacterSpacing(CustomEntryHandler handler, ICustomEntry entry) { } 19 | 20 | public static void MapHorizontalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) { } 21 | 22 | public static void MapVerticalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) { } 23 | } 24 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/MacCatalyst/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UIRequiredDeviceCapabilities 11 | 12 | arm64 13 | 14 | UISupportedInterfaceOrientations 15 | 16 | UIInterfaceOrientationPortrait 17 | UIInterfaceOrientationLandscapeLeft 18 | UIInterfaceOrientationLandscapeRight 19 | 20 | UISupportedInterfaceOrientations~ipad 21 | 22 | UIInterfaceOrientationPortrait 23 | UIInterfaceOrientationPortraitUpsideDown 24 | UIInterfaceOrientationLandscapeLeft 25 | UIInterfaceOrientationLandscapeRight 26 | 27 | XSAppIconAssets 28 | Assets.xcassets/appicon.appiconset 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Library.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst 4 | $(TargetFrameworks);net6.0-windows10.0.19041 5 | true 6 | true 7 | enable 8 | 14.2 9 | 14.0 10 | 21.0 11 | 10.0.17763.0 12 | 10.0.17763.0 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSRequiresIPhoneOS 6 | 7 | UIDeviceFamily 8 | 9 | 1 10 | 2 11 | 12 | UIRequiredDeviceCapabilities 13 | 14 | arm64 15 | 16 | UISupportedInterfaceOrientations 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationLandscapeLeft 20 | UIInterfaceOrientationLandscapeRight 21 | 22 | UISupportedInterfaceOrientations~ipad 23 | 24 | UIInterfaceOrientationPortrait 25 | UIInterfaceOrientationPortraitUpsideDown 26 | UIInterfaceOrientationLandscapeLeft 27 | UIInterfaceOrientationLandscapeRight 28 | 29 | XSAppIconAssets 30 | Assets.xcassets/appicon.appiconset 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | using UIKit; 3 | 4 | namespace Library.Sample.iOS 5 | { 6 | // The UIApplicationDelegate for the application. This class is responsible for launching the 7 | // User Interface of the application, as well as listening (and optionally responding) to 8 | // application events from iOS. 9 | [Register("AppDelegate")] 10 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 11 | { 12 | // 13 | // This method is invoked when the application has loaded and is ready to run. In this 14 | // method you should instantiate the window, load the UI into it and then make the window 15 | // visible. 16 | // 17 | // You have 17 seconds to return from this method, or iOS will terminate your application. 18 | // 19 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 20 | { 21 | global::Xamarin.Forms.Forms.Init(); 22 | LoadApplication(new App()); 23 | 24 | return base.FinishedLaunching(app, options); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Handlers/CustomEntryHandler.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Microsoft.Maui.Handlers; 3 | 4 | namespace Library.Handlers 5 | { 6 | public partial class CustomEntryHandler 7 | { 8 | public static PropertyMapper CustomEntryMapper = new PropertyMapper(ViewHandler.ViewMapper) 9 | { 10 | [nameof(ICustomEntry.Text)] = MapText, 11 | [nameof(ICustomEntry.TextColor)] = MapTextColor, 12 | [nameof(ICustomEntry.Placeholder)] = MapPlaceholder, 13 | [nameof(ICustomEntry.PlaceholderColor)] = MapPlaceholderColor, 14 | [nameof(ICustomEntry.CharacterSpacing)] = MapCharacterSpacing, 15 | [nameof(ICustomEntry.HorizontalLayoutAlignment)] = MapHorizontalLayoutAlignment, 16 | [nameof(ICustomEntry.VerticalLayoutAlignment)] = MapVerticalLayoutAlignment 17 | }; 18 | 19 | public CustomEntryHandler() : base(CustomEntryMapper) 20 | { 21 | 22 | } 23 | 24 | public CustomEntryHandler(PropertyMapper mapper = null) : base(mapper ?? CustomEntryMapper) 25 | { 26 | 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Platforms/Windows/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | User Name 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Library.Sample.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Library.Sample.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | [assembly: AssemblyVersion("1.0.0.0")] 26 | [assembly: AssemblyFileVersion("1.0.0.0")] 27 | 28 | // Add some common permissions, these can be removed if not needed 29 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 30 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 31 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/iOS/CustomEntryHandler.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Microsoft.Maui.Handlers; 3 | using UIKit; 4 | 5 | namespace Library.Handlers 6 | { 7 | public partial class CustomEntryHandler : ViewHandler 8 | { 9 | protected override UIView CreatePlatformView() => throw new NotImplementedException(); 10 | 11 | [MissingMapper] 12 | public static void MapText(CustomEntryHandler handler, ICustomEntry entry) { } 13 | 14 | [MissingMapper] 15 | public static void MapTextColor(CustomEntryHandler handler, ICustomEntry entry) { } 16 | 17 | [MissingMapper] 18 | public static void MapPlaceholder(CustomEntryHandler handler, ICustomEntry entry) { } 19 | 20 | [MissingMapper] 21 | public static void MapPlaceholderColor(CustomEntryHandler handler, ICustomEntry entry) { } 22 | 23 | [MissingMapper] 24 | public static void MapCharacterSpacing(CustomEntryHandler handler, ICustomEntry entry) { } 25 | 26 | [MissingMapper] 27 | public static void MapHorizontalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) { } 28 | 29 | [MissingMapper] 30 | public static void MapVerticalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) { } 31 | } 32 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/MacCatalyst/CustomEntryHandler.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Microsoft.Maui.Handlers; 3 | using UIKit; 4 | 5 | namespace Library.Handlers 6 | { 7 | public partial class CustomEntryHandler : ViewHandler 8 | { 9 | protected override UIView CreatePlatformView() => throw new NotImplementedException(); 10 | 11 | [MissingMapper] 12 | public static void MapText(CustomEntryHandler handler, ICustomEntry entry) { } 13 | 14 | [MissingMapper] 15 | public static void MapTextColor(CustomEntryHandler handler, ICustomEntry entry) { } 16 | 17 | [MissingMapper] 18 | public static void MapPlaceholder(CustomEntryHandler handler, ICustomEntry entry) { } 19 | 20 | [MissingMapper] 21 | public static void MapPlaceholderColor(CustomEntryHandler handler, ICustomEntry entry) { } 22 | 23 | [MissingMapper] 24 | public static void MapCharacterSpacing(CustomEntryHandler handler, ICustomEntry entry) { } 25 | 26 | [MissingMapper] 27 | public static void MapHorizontalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) { } 28 | 29 | [MissingMapper] 30 | public static void MapVerticalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) { } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Content.PM; 3 | using Android.Runtime; 4 | using Android.OS; 5 | 6 | namespace Library.Sample.Droid 7 | { 8 | [Activity(Label = "Library.Sample", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )] 9 | public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity 10 | { 11 | protected override void OnCreate(Bundle savedInstanceState) 12 | { 13 | base.OnCreate(savedInstanceState); 14 | 15 | Xamarin.Essentials.Platform.Init(this, savedInstanceState); 16 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState); 17 | LoadApplication(new App()); 18 | } 19 | 20 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) 21 | { 22 | Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); 23 | 24 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/Windows/CustomEntryHandler.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Microsoft.Maui.Handlers; 3 | using Microsoft.UI.Xaml; 4 | 5 | namespace Library.Handlers 6 | { 7 | public partial class CustomEntryHandler : ViewHandler 8 | { 9 | protected override FrameworkElement CreatePlatformView() => throw new NotImplementedException(); 10 | 11 | [MissingMapper] 12 | public static void MapText(CustomEntryHandler handler, ICustomEntry entry) { } 13 | 14 | [MissingMapper] 15 | public static void MapTextColor(CustomEntryHandler handler, ICustomEntry entry) { } 16 | 17 | [MissingMapper] 18 | public static void MapPlaceholder(CustomEntryHandler handler, ICustomEntry entry) { } 19 | 20 | [MissingMapper] 21 | public static void MapPlaceholderColor(CustomEntryHandler handler, ICustomEntry entry) { } 22 | 23 | [MissingMapper] 24 | public static void MapCharacterSpacing(CustomEntryHandler handler, ICustomEntry entry) { } 25 | 26 | [MissingMapper] 27 | public static void MapHorizontalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) { } 28 | 29 | [MissingMapper] 30 | public static void MapVerticalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) { } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UISupportedInterfaceOrientations 11 | 12 | UIInterfaceOrientationPortrait 13 | UIInterfaceOrientationLandscapeLeft 14 | UIInterfaceOrientationLandscapeRight 15 | 16 | UISupportedInterfaceOrientations~ipad 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationPortraitUpsideDown 20 | UIInterfaceOrientationLandscapeLeft 21 | UIInterfaceOrientationLandscapeRight 22 | 23 | MinimumOSVersion 24 | 8.0 25 | CFBundleDisplayName 26 | Library.Sample 27 | CFBundleIdentifier 28 | com.companyname.Library.Sample 29 | CFBundleVersion 30 | 1.0 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | CFBundleName 34 | Library.Sample 35 | XSAppIconAssets 36 | Assets.xcassets/AppIcon.appiconset 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Library.Sample.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Library.Sample.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Library.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netstandard2.0;xamarinios10;monoandroid10.0; 4 | false 5 | latest 6 | portable 7 | Debug;Release 8 | false 9 | portable 10 | NU1701 11 | 12 | 13 | 14 | 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Hosting/AppHostBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Library.Controls; 2 | using Library.Effects; 3 | using Library.Handlers; 4 | using Microsoft.Extensions.DependencyInjection.Extensions; 5 | using Microsoft.Maui.Controls.Compatibility.Hosting; 6 | 7 | namespace Library.Hosting 8 | { 9 | public static class AppHostBuilderExtensions 10 | { 11 | public static MauiAppBuilder ConfigureLibrary(this MauiAppBuilder builder, bool useCompatibilityRenderers = false) 12 | { 13 | builder 14 | .ConfigureEffects(effects => 15 | { 16 | effects.Add(typeof(FocusRoutingEffect), typeof(PlatformFocusPlatformEffect)); 17 | }) 18 | .ConfigureMauiHandlers(handlers => 19 | { 20 | if (useCompatibilityRenderers) 21 | handlers.AddLibraryCompatibilityRenderers(); 22 | else 23 | handlers.AddLibraryHandlers(); 24 | }); 25 | 26 | return builder; 27 | } 28 | 29 | public static IMauiHandlersCollection AddLibraryCompatibilityRenderers(this IMauiHandlersCollection handlers) 30 | { 31 | #if __ANDROID__ 32 | handlers.AddCompatibilityRenderer(typeof(CustomEntry), typeof(Renderers.Android.CustomEntryRenderer)); 33 | #endif 34 | return handlers; 35 | } 36 | 37 | public static IMauiHandlersCollection AddLibraryHandlers(this IMauiHandlersCollection handlers) 38 | { 39 | handlers.AddTransient(typeof(CustomEntry), h => new CustomEntryHandler()); 40 | 41 | return handlers; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Resources/appiconfg.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Effects/FocusRoutingEffectImpl.ios.cs: -------------------------------------------------------------------------------- 1 | using Effects.iOS.Effects; 2 | using System; 3 | using System.ComponentModel; 4 | using Xamarin.Forms; 5 | using Xamarin.Forms.Platform.iOS; 6 | 7 | [assembly: ResolutionGroupName("Effects")] 8 | [assembly: ExportEffect(typeof(FocusPlatformEffectImpl), "FocusEffect")] 9 | namespace Library.Effects.iOS 10 | { 11 | public class FocusPlatformEffectImpl : PlatformEffect 12 | { 13 | UIKit.UIColor backgroundColor; 14 | 15 | protected override void OnAttached() 16 | { 17 | try 18 | { 19 | Control.BackgroundColor = backgroundColor = UIKit.UIColor.FromRGB(204, 153, 255); 20 | } 21 | catch (Exception ex) 22 | { 23 | Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message); 24 | } 25 | } 26 | 27 | protected override void OnDetached() 28 | { 29 | } 30 | 31 | protected override void OnElementPropertyChanged(PropertyChangedEventArgs args) 32 | { 33 | base.OnElementPropertyChanged(args); 34 | 35 | try 36 | { 37 | if (args.PropertyName == "IsFocused") 38 | { 39 | if (Control.BackgroundColor == backgroundColor) 40 | { 41 | Control.BackgroundColor = UIKit.UIColor.White; 42 | } 43 | else 44 | { 45 | Control.BackgroundColor = backgroundColor; 46 | } 47 | } 48 | } 49 | catch (Exception ex) 50 | { 51 | Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message); 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.2.32317.152 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library", "Library\Library.csproj", "{6CD7F4B9-330D-4D36-99A3-F8038044A366}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library.Sample", "Library.Sample\Library.Sample.csproj", "{8C2A8DE6-11F1-49BD-82A0-A6347EFBF82F}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {6CD7F4B9-330D-4D36-99A3-F8038044A366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {6CD7F4B9-330D-4D36-99A3-F8038044A366}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {6CD7F4B9-330D-4D36-99A3-F8038044A366}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {6CD7F4B9-330D-4D36-99A3-F8038044A366}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {8C2A8DE6-11F1-49BD-82A0-A6347EFBF82F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {8C2A8DE6-11F1-49BD-82A0-A6347EFBF82F}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {8C2A8DE6-11F1-49BD-82A0-A6347EFBF82F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 23 | {8C2A8DE6-11F1-49BD-82A0-A6347EFBF82F}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {8C2A8DE6-11F1-49BD-82A0-A6347EFBF82F}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {8C2A8DE6-11F1-49BD-82A0-A6347EFBF82F}.Release|Any CPU.Deploy.0 = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | GlobalSection(ExtensibilityGlobals) = postSolution 31 | SolutionGuid = {3801AF30-48BA-47C2-86B7-939AB6020D81} 32 | EndGlobalSection 33 | EndGlobal 34 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Renderers/TextAlignmentExtensions.android.cs: -------------------------------------------------------------------------------- 1 | using Android.Views; 2 | using Android.Widget; 3 | using ATextAlignment = Android.Views.TextAlignment; 4 | 5 | namespace Library.Extensions.Android 6 | { 7 | public static class TextAlignmentExtensions 8 | { 9 | public static void UpdateTextAlignment(this EditText view, Xamarin.Forms.TextAlignment horizontal, Xamarin.Forms.TextAlignment vertical) 10 | { 11 | if (view.Context != null) 12 | { 13 | view.Gravity = vertical.ToVerticalGravityFlags() | horizontal.ToHorizontalGravityFlags(); 14 | } 15 | else 16 | { 17 | view.TextAlignment = horizontal.ToTextAlignment(); 18 | view.Gravity = vertical.ToVerticalGravityFlags(); 19 | } 20 | } 21 | 22 | internal static ATextAlignment ToTextAlignment(this Xamarin.Forms.TextAlignment alignment) 23 | { 24 | switch (alignment) 25 | { 26 | case Xamarin.Forms.TextAlignment.Center: 27 | return ATextAlignment.Center; 28 | case Xamarin.Forms.TextAlignment.End: 29 | return ATextAlignment.ViewEnd; 30 | default: 31 | return ATextAlignment.ViewStart; 32 | } 33 | } 34 | 35 | internal static GravityFlags ToHorizontalGravityFlags(this Xamarin.Forms.TextAlignment alignment) 36 | { 37 | switch (alignment) 38 | { 39 | case Xamarin.Forms.TextAlignment.Center: 40 | return GravityFlags.CenterHorizontal; 41 | case Xamarin.Forms.TextAlignment.End: 42 | return GravityFlags.End; 43 | default: 44 | return GravityFlags.Start; 45 | } 46 | } 47 | 48 | internal static GravityFlags ToVerticalGravityFlags(this Xamarin.Forms.TextAlignment alignment) 49 | { 50 | switch (alignment) 51 | { 52 | case Xamarin.Forms.TextAlignment.Start: 53 | return GravityFlags.Top; 54 | case Xamarin.Forms.TextAlignment.End: 55 | return GravityFlags.Bottom; 56 | default: 57 | return GravityFlags.CenterVertical; 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/Android/TextAlignmentExtensions.cs: -------------------------------------------------------------------------------- 1 | using Android.Views; 2 | using Android.Widget; 3 | using ATextAlignment = Android.Views.TextAlignment; 4 | 5 | namespace Library.Extensions.Android 6 | { 7 | public static class TextAlignmentExtensions 8 | { 9 | public static void UpdateTextAlignment(this EditText view, Microsoft.Maui.TextAlignment horizontal, Microsoft.Maui.TextAlignment vertical) 10 | { 11 | if (view.Context != null) 12 | { 13 | view.Gravity = vertical.ToVerticalGravityFlags() | horizontal.ToHorizontalGravityFlags(); 14 | } 15 | else 16 | { 17 | view.TextAlignment = horizontal.ToTextAlignment(); 18 | view.Gravity = vertical.ToVerticalGravityFlags(); 19 | } 20 | } 21 | 22 | internal static ATextAlignment ToTextAlignment(this Microsoft.Maui.TextAlignment alignment) 23 | { 24 | switch (alignment) 25 | { 26 | case Microsoft.Maui.TextAlignment.Center: 27 | return ATextAlignment.Center; 28 | case Microsoft.Maui.TextAlignment.End: 29 | return ATextAlignment.ViewEnd; 30 | default: 31 | return ATextAlignment.ViewStart; 32 | } 33 | } 34 | 35 | internal static GravityFlags ToHorizontalGravityFlags(this Microsoft.Maui.TextAlignment alignment) 36 | { 37 | switch (alignment) 38 | { 39 | case Microsoft.Maui.TextAlignment.Center: 40 | return GravityFlags.CenterHorizontal; 41 | case Microsoft.Maui.TextAlignment.End: 42 | return GravityFlags.End; 43 | default: 44 | return GravityFlags.Start; 45 | } 46 | } 47 | 48 | internal static GravityFlags ToVerticalGravityFlags(this Microsoft.Maui.TextAlignment alignment) 49 | { 50 | switch (alignment) 51 | { 52 | case Microsoft.Maui.TextAlignment.Start: 53 | return GravityFlags.Top; 54 | case Microsoft.Maui.TextAlignment.End: 55 | return GravityFlags.Bottom; 56 | default: 57 | return GravityFlags.CenterVertical; 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.Android/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.xml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable-hdpi/ 12 | icon.png 13 | 14 | drawable-ldpi/ 15 | icon.png 16 | 17 | drawable-mdpi/ 18 | icon.png 19 | 20 | layout/ 21 | main.xml 22 | 23 | values/ 24 | strings.xml 25 | 26 | In order to get the build system to recognize Android resources, set the build action to 27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 28 | instead operate on resource IDs. When you compile an Android application that uses resources, 29 | the build system will package the resources for distribution and generate a class called 30 | "Resource" that contains the tokens for each one of the resources included. For example, 31 | for the above Resources layout, this is what the Resource class would expose: 32 | 33 | public class Resource { 34 | public class drawable { 35 | public const int icon = 0x123; 36 | } 37 | 38 | public class layout { 39 | public const int main = 0x456; 40 | } 41 | 42 | public class strings { 43 | public const int first_string = 0xabc; 44 | public const int second_string = 0xbcd; 45 | } 46 | } 47 | 48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main 49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first 50 | string in the dictionary file values/strings.xml. 51 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Effects/FocusRoutingEffectImpl.android.cs: -------------------------------------------------------------------------------- 1 | using Effects.Droid.Effects; 2 | using System; 3 | using System.ComponentModel; 4 | using Xamarin.Forms; 5 | using Xamarin.Forms.Platform.Android; 6 | 7 | [assembly: ResolutionGroupName("Effects")] 8 | [assembly: ExportEffect(typeof(FocusPlatformEffectImpl), "FocusEffect")] 9 | namespace Library.Effects.Android 10 | { 11 | public class FocusPlatformEffectImpl : PlatformEffect 12 | { 13 | Android.Graphics.Color originalBackgroundColor = new Android.Graphics.Color(0, 0, 0, 0); 14 | Android.Graphics.Color backgroundColor; 15 | 16 | protected override void OnAttached() 17 | { 18 | try 19 | { 20 | backgroundColor = Android.Graphics.Color.LightGreen; 21 | Control.SetBackgroundColor(backgroundColor); 22 | } 23 | catch (Exception ex) 24 | { 25 | Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message); 26 | } 27 | } 28 | 29 | protected override void OnDetached() 30 | { 31 | } 32 | 33 | protected override void OnElementPropertyChanged(PropertyChangedEventArgs args) 34 | { 35 | base.OnElementPropertyChanged(args); 36 | try 37 | { 38 | if (args.PropertyName == "IsFocused") 39 | { 40 | if (((Android.Graphics.Drawables.ColorDrawable)Control.Background).Color == backgroundColor) 41 | { 42 | Control.SetBackgroundColor(originalBackgroundColor); 43 | } 44 | else 45 | { 46 | Control.SetBackgroundColor(backgroundColor); 47 | } 48 | } 49 | } 50 | catch (Exception ex) 51 | { 52 | Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message); 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.Sample/Library.Sample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0-android;net6.0-ios;net6.0-maccatalyst 5 | $(TargetFrameworks);net6.0-windows10.0.19041 6 | Exe 7 | Library.Sample 8 | true 9 | true 10 | enable 11 | 12 | 13 | Library.Sample 14 | 15 | 16 | com.companyname.library.sample 17 | FD9229F6-A286-4DB7-905C-335CF8B3F2B1 18 | 19 | 20 | 1.0 21 | 1 22 | 23 | 14.2 24 | 14.0 25 | 21.0 26 | 10.0.17763.0 27 | 10.0.17763.0 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library.MultiTargeting.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | false 37 | 38 | 39 | 40 | 41 | $(DefineConstants);MONOANDROID 42 | 43 | 44 | 45 | 46 | $(DefineConstants);IOS 47 | 48 | 49 | 50 | 51 | $(DefineConstants);MACCATALYST;IOS 52 | 53 | 54 | 55 | 56 | 10.0.17763.0 57 | win10-x86;win10-x64;win10-arm64 58 | WINDOWS;$(DefineConstants) 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Resources/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "scale": "2x", 5 | "size": "20x20", 6 | "idiom": "iphone", 7 | "filename": "Icon40.png" 8 | }, 9 | { 10 | "scale": "3x", 11 | "size": "20x20", 12 | "idiom": "iphone", 13 | "filename": "Icon60.png" 14 | }, 15 | { 16 | "scale": "2x", 17 | "size": "29x29", 18 | "idiom": "iphone", 19 | "filename": "Icon58.png" 20 | }, 21 | { 22 | "scale": "3x", 23 | "size": "29x29", 24 | "idiom": "iphone", 25 | "filename": "Icon87.png" 26 | }, 27 | { 28 | "scale": "2x", 29 | "size": "40x40", 30 | "idiom": "iphone", 31 | "filename": "Icon80.png" 32 | }, 33 | { 34 | "scale": "3x", 35 | "size": "40x40", 36 | "idiom": "iphone", 37 | "filename": "Icon120.png" 38 | }, 39 | { 40 | "scale": "2x", 41 | "size": "60x60", 42 | "idiom": "iphone", 43 | "filename": "Icon120.png" 44 | }, 45 | { 46 | "scale": "3x", 47 | "size": "60x60", 48 | "idiom": "iphone", 49 | "filename": "Icon180.png" 50 | }, 51 | { 52 | "scale": "1x", 53 | "size": "20x20", 54 | "idiom": "ipad", 55 | "filename": "Icon20.png" 56 | }, 57 | { 58 | "scale": "2x", 59 | "size": "20x20", 60 | "idiom": "ipad", 61 | "filename": "Icon40.png" 62 | }, 63 | { 64 | "scale": "1x", 65 | "size": "29x29", 66 | "idiom": "ipad", 67 | "filename": "Icon29.png" 68 | }, 69 | { 70 | "scale": "2x", 71 | "size": "29x29", 72 | "idiom": "ipad", 73 | "filename": "Icon58.png" 74 | }, 75 | { 76 | "scale": "1x", 77 | "size": "40x40", 78 | "idiom": "ipad", 79 | "filename": "Icon40.png" 80 | }, 81 | { 82 | "scale": "2x", 83 | "size": "40x40", 84 | "idiom": "ipad", 85 | "filename": "Icon80.png" 86 | }, 87 | { 88 | "scale": "1x", 89 | "size": "76x76", 90 | "idiom": "ipad", 91 | "filename": "Icon76.png" 92 | }, 93 | { 94 | "scale": "2x", 95 | "size": "76x76", 96 | "idiom": "ipad", 97 | "filename": "Icon152.png" 98 | }, 99 | { 100 | "scale": "2x", 101 | "size": "83.5x83.5", 102 | "idiom": "ipad", 103 | "filename": "Icon167.png" 104 | }, 105 | { 106 | "scale": "1x", 107 | "size": "1024x1024", 108 | "idiom": "ios-marketing", 109 | "filename": "Icon1024.png" 110 | } 111 | ], 112 | "properties": {}, 113 | "info": { 114 | "version": 1, 115 | "author": "xcode" 116 | } 117 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/Android/CustomEntryExtensions.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Android.Content.Res; 3 | using Android.Widget; 4 | using Library.Controls; 5 | using Microsoft.Maui.Platform; 6 | using AResource = Android.Resource; 7 | 8 | namespace Library.Extensions.Android 9 | { 10 | public static class CustomEntryExtensions 11 | { 12 | static readonly int[][] ColorStates = 13 | { 14 | new[] { AResource.Attribute.StateEnabled }, 15 | new[] { -AResource.Attribute.StateEnabled } 16 | }; 17 | 18 | public static void UpdateText(this EditText editText, ICustomEntry entry) 19 | { 20 | editText.Text = entry.Text; 21 | } 22 | 23 | public static void UpdateTextColor(this EditText editText, ICustomEntry entry, ColorStateList? defaultTextColors) 24 | { 25 | var textColor = entry.TextColor; 26 | 27 | if (textColor == null) 28 | { 29 | if (defaultTextColors != null) 30 | editText.SetTextColor(defaultTextColors); 31 | } 32 | else 33 | { 34 | var androidColor = textColor.ToPlatform(); 35 | 36 | if (!editText.TextColors.IsOneColor(ColorStates, androidColor)) 37 | { 38 | var acolor = androidColor.ToArgb(); 39 | editText.SetTextColor(new ColorStateList(ColorStates, new[] { acolor, acolor })); 40 | } 41 | } 42 | } 43 | 44 | public static void UpdatePlaceholder(this EditText editText, ICustomEntry entry) 45 | { 46 | if (editText.Hint == entry.Placeholder) 47 | return; 48 | 49 | editText.Hint = entry.Placeholder; 50 | } 51 | 52 | public static void UpdatePlaceholderColor(this EditText editText, ICustomEntry entry, ColorStateList? defaultPlaceholderColors) 53 | { 54 | var placeholderTextColor = entry.PlaceholderColor; 55 | 56 | if (placeholderTextColor == null) 57 | { 58 | editText.SetHintTextColor(defaultPlaceholderColors); 59 | } 60 | else 61 | { 62 | var androidColor = placeholderTextColor.ToPlatform(); 63 | 64 | if (!editText.HintTextColors.IsOneColor(ColorStates, androidColor)) 65 | { 66 | var acolor = androidColor.ToArgb(); 67 | editText.SetHintTextColor(new ColorStateList(ColorStates, new[] { acolor, acolor })); 68 | } 69 | } 70 | } 71 | 72 | public static void UpdateCharacterSpacing(this EditText editText, ICustomEntry entry) 73 | { 74 | editText.LetterSpacing = entry.CharacterSpacing.ToEm(); 75 | } 76 | 77 | public static void UpdateHorizontalLayoutAlignment(this EditText editText, ICustomEntry entry) 78 | { 79 | editText.UpdateTextAlignment(entry.HorizontalTextAlignment, entry.VerticalTextAlignment); 80 | } 81 | 82 | public static void UpdateVerticaLayoutAlignment(this EditText editText, ICustomEntry entry) 83 | { 84 | editText.UpdateTextAlignment(entry.HorizontalTextAlignment, entry.VerticalTextAlignment); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Controls/CustomEntry.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Library.Controls 4 | { 5 | public class CustomEntry : View, ICustomEntry 6 | { 7 | public static readonly BindableProperty TextProperty = 8 | BindableProperty.Create(nameof(Text), typeof(string), typeof(Entry), string.Empty); 9 | 10 | public static readonly BindableProperty TextColorProperty = 11 | BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(Entry), Colors.Black); 12 | 13 | public static readonly BindableProperty PlaceholderProperty = 14 | BindableProperty.Create(nameof(Placeholder), typeof(string), typeof(Entry), string.Empty); 15 | 16 | public static readonly BindableProperty PlaceholderColorProperty = 17 | BindableProperty.Create(nameof(PlaceholderColor), typeof(Color), typeof(Entry), Colors.Black); 18 | 19 | public static readonly BindableProperty CharacterSpacingProperty = 20 | BindableProperty.Create(nameof(CharacterSpacing), typeof(double), typeof(Entry), 0.0d); 21 | 22 | public static readonly BindableProperty HorizontalTextAlignmentProperty = 23 | BindableProperty.Create(nameof(HorizontalTextAlignment), typeof(TextAlignment), typeof(Entry), TextAlignment.Start); 24 | 25 | public static readonly BindableProperty VerticalTextAlignmentProperty = 26 | BindableProperty.Create(nameof(VerticalTextAlignment), typeof(TextAlignment), typeof(Entry), TextAlignment.Start); 27 | 28 | public string Text 29 | { 30 | get { return (string)GetValue(TextProperty); } 31 | set { SetValue(TextProperty, value); } 32 | } 33 | 34 | public Color TextColor 35 | { 36 | get { return (Color)GetValue(TextColorProperty); } 37 | set { SetValue(TextColorProperty, value); } 38 | } 39 | public string Placeholder 40 | { 41 | get { return (string)GetValue(PlaceholderProperty); } 42 | set { SetValue(PlaceholderProperty, value); } 43 | } 44 | 45 | public Color PlaceholderColor 46 | { 47 | get { return (Color)GetValue(PlaceholderColorProperty); } 48 | set { SetValue(PlaceholderColorProperty, value); } 49 | } 50 | 51 | public double CharacterSpacing 52 | { 53 | get { return (double)GetValue(CharacterSpacingProperty); } 54 | set { SetValue(CharacterSpacingProperty, value); } 55 | } 56 | 57 | public TextAlignment HorizontalTextAlignment 58 | { 59 | get { return (TextAlignment)GetValue(HorizontalTextAlignmentProperty); } 60 | set { SetValue(HorizontalTextAlignmentProperty, value); } 61 | } 62 | 63 | public TextAlignment VerticalTextAlignment 64 | { 65 | get { return (TextAlignment)GetValue(VerticalTextAlignmentProperty); } 66 | set { SetValue(VerticalTextAlignmentProperty, value); } 67 | } 68 | 69 | public event EventHandler Completed; 70 | 71 | [EditorBrowsable(EditorBrowsableState.Never)] 72 | public void SendCompleted() 73 | { 74 | if (IsEnabled) 75 | { 76 | Completed?.Invoke(this, EventArgs.Empty); 77 | } 78 | } 79 | } 80 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library/Renderers/CustomEntry.shared.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using Xamarin.Forms; 4 | 5 | namespace Library.Renderers 6 | { 7 | public class CustomEntry : View 8 | { 9 | public static readonly BindableProperty TextProperty = 10 | BindableProperty.Create(nameof(Text), typeof(string), typeof(Entry), string.Empty); 11 | 12 | public static readonly BindableProperty TextColorProperty = 13 | BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(Entry), Color.Default); 14 | 15 | public static readonly BindableProperty PlaceholderProperty = 16 | BindableProperty.Create(nameof(Placeholder), typeof(string), typeof(Entry), string.Empty); 17 | 18 | public static readonly BindableProperty PlaceholderColorProperty = 19 | BindableProperty.Create(nameof(PlaceholderColor), typeof(Color), typeof(Entry), Color.Default); 20 | 21 | public static readonly BindableProperty CharacterSpacingProperty = 22 | BindableProperty.Create(nameof(CharacterSpacing), typeof(double), typeof(Entry), 0.0d); 23 | 24 | public static readonly BindableProperty HorizontalTextAlignmentProperty = 25 | BindableProperty.Create(nameof(HorizontalTextAlignment), typeof(TextAlignment), typeof(Entry), TextAlignment.Start); 26 | 27 | public static readonly BindableProperty VerticalTextAlignmentProperty = 28 | BindableProperty.Create(nameof(VerticalTextAlignment), typeof(TextAlignment), typeof(Entry), TextAlignment.Start); 29 | 30 | public string Text 31 | { 32 | get { return (string)GetValue(TextProperty); } 33 | set { SetValue(TextProperty, value); } 34 | } 35 | 36 | public Color TextColor 37 | { 38 | get { return (Color)GetValue(TextColorProperty); } 39 | set { SetValue(TextColorProperty, value); } 40 | } 41 | public string Placeholder 42 | { 43 | get { return (string)GetValue(PlaceholderProperty); } 44 | set { SetValue(PlaceholderProperty, value); } 45 | } 46 | 47 | public Color PlaceholderColor 48 | { 49 | get { return (Color)GetValue(PlaceholderColorProperty); } 50 | set { SetValue(PlaceholderColorProperty, value); } 51 | } 52 | 53 | public double CharacterSpacing 54 | { 55 | get { return (double)GetValue(CharacterSpacingProperty); } 56 | set { SetValue(CharacterSpacingProperty, value); } 57 | } 58 | 59 | public TextAlignment HorizontalTextAlignment 60 | { 61 | get { return (TextAlignment)GetValue(HorizontalTextAlignmentProperty); } 62 | set { SetValue(HorizontalTextAlignmentProperty, value); } 63 | } 64 | 65 | public TextAlignment VerticalTextAlignment 66 | { 67 | get { return (TextAlignment)GetValue(VerticalTextAlignmentProperty); } 68 | set { SetValue(VerticalTextAlignmentProperty, value); } 69 | } 70 | 71 | public event EventHandler Completed; 72 | 73 | [EditorBrowsable(EditorBrowsableState.Never)] 74 | public void SendCompleted() 75 | { 76 | if (IsEnabled) 77 | { 78 | Completed?.Invoke(this, EventArgs.Empty); 79 | } 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Platforms/Android/CustomEntryHandler.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using Android.Content.Res; 3 | using Android.Text; 4 | using Android.Widget; 5 | using Library.Controls; 6 | using Library.Extensions.Android; 7 | using Microsoft.Maui.Handlers; 8 | 9 | namespace Library.Handlers 10 | { 11 | public partial class CustomEntryHandler : ViewHandler 12 | { 13 | ColorStateList? _defaultTextColors; 14 | ColorStateList? _defaultPlaceholderColors; 15 | 16 | readonly TextWatcher _watcher = new(); 17 | 18 | protected override EditText CreatePlatformView() 19 | { 20 | return new EditText(Context); 21 | } 22 | 23 | protected override void ConnectHandler(EditText nativeView) 24 | { 25 | _defaultTextColors = nativeView.TextColors; 26 | _defaultPlaceholderColors = nativeView.HintTextColors; 27 | 28 | _watcher.Handler = this; 29 | nativeView.AddTextChangedListener(_watcher); 30 | 31 | base.ConnectHandler(nativeView); 32 | } 33 | 34 | protected override void DisconnectHandler(EditText nativeView) 35 | { 36 | nativeView.RemoveTextChangedListener(_watcher); 37 | _watcher.Handler = null; 38 | 39 | base.DisconnectHandler(nativeView); 40 | } 41 | 42 | public static void MapText(CustomEntryHandler handler, ICustomEntry entry) 43 | { 44 | handler.PlatformView?.UpdateText(entry); 45 | } 46 | 47 | public static void MapTextColor(CustomEntryHandler handler, ICustomEntry entry) 48 | { 49 | handler.PlatformView?.UpdateTextColor(entry, handler._defaultTextColors); 50 | } 51 | 52 | public static void MapPlaceholder(CustomEntryHandler handler, ICustomEntry entry) 53 | { 54 | handler.PlatformView?.UpdatePlaceholder(entry); 55 | } 56 | 57 | public static void MapPlaceholderColor(CustomEntryHandler handler, ICustomEntry entry) 58 | { 59 | handler.PlatformView?.UpdatePlaceholderColor(entry, handler._defaultPlaceholderColors); 60 | } 61 | 62 | public static void MapCharacterSpacing(CustomEntryHandler handler, ICustomEntry entry) 63 | { 64 | handler.PlatformView?.UpdateCharacterSpacing(entry); 65 | } 66 | 67 | public static void MapHorizontalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) 68 | { 69 | handler.PlatformView?.UpdateHorizontalLayoutAlignment(entry); 70 | } 71 | 72 | public static void MapVerticalLayoutAlignment(CustomEntryHandler handler, ICustomEntry entry) 73 | { 74 | handler.PlatformView?.UpdateVerticaLayoutAlignment(entry); 75 | } 76 | 77 | class TextWatcher : Java.Lang.Object, ITextWatcher 78 | { 79 | public CustomEntryHandler? Handler { get; set; } 80 | 81 | void ITextWatcher.AfterTextChanged(IEditable? s) 82 | { 83 | } 84 | 85 | void ITextWatcher.BeforeTextChanged(Java.Lang.ICharSequence? s, int start, int count, int after) 86 | { 87 | } 88 | 89 | void ITextWatcher.OnTextChanged(Java.Lang.ICharSequence? s, int start, int before, int count) 90 | { 91 | // We are replacing 0 characters with 0 characters, so skip 92 | if (before == 0 && count == 0) 93 | return; 94 | 95 | Handler?.VirtualView?.SendCompleted(); 96 | } 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /src/.NET MAUI/Library/Library/Effects/FocusRoutingEffect.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui.Controls; 2 | using System; 3 | using System.ComponentModel; 4 | 5 | namespace Library.Effects 6 | { 7 | public class FocusRoutingEffect : RoutingEffect 8 | { 9 | 10 | } 11 | 12 | #if WINDOWS 13 | public class PlatformFocusPlatformEffect : Microsoft.Maui.Controls.Platform.PlatformEffect 14 | { 15 | public PlatformFocusPlatformEffect() : base() 16 | { 17 | } 18 | 19 | protected override void OnAttached() 20 | { 21 | try 22 | { 23 | if (Control is Microsoft.UI.Xaml.Controls.Control control) 24 | control.Background = new Microsoft.UI.Xaml.Media.SolidColorBrush(Microsoft.UI.Colors.Cyan); 25 | } 26 | catch (Exception ex) 27 | { 28 | System.Diagnostics.Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message); 29 | } 30 | 31 | } 32 | 33 | protected override void OnDetached() 34 | { 35 | } 36 | } 37 | #elif __ANDROID__ 38 | public class PlatformFocusPlatformEffect : Microsoft.Maui.Controls.Platform.PlatformEffect 39 | { 40 | Android.Graphics.Color originalBackgroundColor = new Android.Graphics.Color(0, 0, 0, 0); 41 | Android.Graphics.Color backgroundColor; 42 | 43 | protected override void OnAttached() 44 | { 45 | try 46 | { 47 | backgroundColor = Android.Graphics.Color.LightGreen; 48 | Control.SetBackgroundColor(backgroundColor); 49 | } 50 | catch (Exception ex) 51 | { 52 | Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message); 53 | } 54 | } 55 | 56 | protected override void OnDetached() 57 | { 58 | } 59 | 60 | protected override void OnElementPropertyChanged(PropertyChangedEventArgs args) 61 | { 62 | base.OnElementPropertyChanged(args); 63 | try 64 | { 65 | if (args.PropertyName == "IsFocused") 66 | { 67 | if (((Android.Graphics.Drawables.ColorDrawable)Control.Background).Color == backgroundColor) 68 | { 69 | Control.SetBackgroundColor(originalBackgroundColor); 70 | } 71 | else 72 | { 73 | Control.SetBackgroundColor(backgroundColor); 74 | } 75 | } 76 | } 77 | catch (Exception ex) 78 | { 79 | Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message); 80 | } 81 | } 82 | } 83 | #elif __IOS__ 84 | public class PlatformFocusPlatformEffect : Microsoft.Maui.Controls.Platform.PlatformEffect 85 | { 86 | UIKit.UIColor backgroundColor; 87 | 88 | protected override void OnAttached() 89 | { 90 | try 91 | { 92 | Control.BackgroundColor = backgroundColor = UIKit.UIColor.FromRGB(204, 153, 255); 93 | } 94 | catch (Exception ex) 95 | { 96 | Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message); 97 | } 98 | } 99 | 100 | protected override void OnDetached() 101 | { 102 | } 103 | 104 | protected override void OnElementPropertyChanged(PropertyChangedEventArgs args) 105 | { 106 | base.OnElementPropertyChanged(args); 107 | 108 | try 109 | { 110 | if (args.PropertyName == "IsFocused") 111 | { 112 | if (Control.BackgroundColor == backgroundColor) 113 | { 114 | Control.BackgroundColor = UIKit.UIColor.White; 115 | } 116 | else 117 | { 118 | Control.BackgroundColor = backgroundColor; 119 | } 120 | } 121 | } 122 | catch (Exception ex) 123 | { 124 | Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message); 125 | } 126 | } 127 | } 128 | #elif STANDARD 129 | public class PlatformFocusPlatformEffect 130 | { 131 | } 132 | #endif 133 | } -------------------------------------------------------------------------------- /src/Xamarin.Forms/Library.Sample/Library.Sample/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 30 |