diff --git a/.gitignore b/.gitignore index 6505f9a..0ebc03e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ ################################################################################ /.vs/MauiBugs/FileContentIndex +/FormattingBug/.vs +/FormattingBug/bin/Debug/net6.0-android +/FormattingBug/obj diff --git a/FormattingBug/App.xaml b/FormattingBug/App.xaml new file mode 100644 index 0000000..b5e4337 --- /dev/null +++ b/FormattingBug/App.xaml @@ -0,0 +1,9 @@ + + + + + + diff --git a/FormattingBug/App.xaml.cs b/FormattingBug/App.xaml.cs new file mode 100644 index 0000000..2e4b61b --- /dev/null +++ b/FormattingBug/App.xaml.cs @@ -0,0 +1,11 @@ +namespace FormattingBug; + +public partial class App : Application +{ + public App() + { + InitializeComponent(); + + MainPage = new AppShell(); + } +} diff --git a/FormattingBug/AppShell.xaml b/FormattingBug/AppShell.xaml new file mode 100644 index 0000000..00c2d7f --- /dev/null +++ b/FormattingBug/AppShell.xaml @@ -0,0 +1,14 @@ + + + + + + diff --git a/FormattingBug/AppShell.xaml.cs b/FormattingBug/AppShell.xaml.cs new file mode 100644 index 0000000..b96cc7d --- /dev/null +++ b/FormattingBug/AppShell.xaml.cs @@ -0,0 +1,9 @@ +namespace FormattingBug; + +public partial class AppShell : Shell +{ + public AppShell() + { + InitializeComponent(); + } +} diff --git a/FormattingBug/Converter.cs b/FormattingBug/Converter.cs new file mode 100644 index 0000000..123a54b --- /dev/null +++ b/FormattingBug/Converter.cs @@ -0,0 +1,27 @@ +using System.Globalization; +using System.Text.RegularExpressions; + +namespace FormattingBug; + +public class DecimalCurrencyConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return decimal.Parse(value.ToString()).ToString("c2", culture); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + var isNegative = Regex.IsMatch(value.ToString(), "^-", RegexOptions.CultureInvariant); + var valueFromString = Regex.Replace(value.ToString(), @"\$|,", ""); + + if (string.IsNullOrEmpty(valueFromString)) + { + return 0m; + } + + return valueFromString.Length <= 0 + ? 0m + : !decimal.TryParse(valueFromString, out var decimalVal) ? 0m : (object)(isNegative ? decimalVal * -1 : decimalVal); + } +} diff --git a/FormattingBug/FormattingBug.csproj b/FormattingBug/FormattingBug.csproj new file mode 100644 index 0000000..f62d4cd --- /dev/null +++ b/FormattingBug/FormattingBug.csproj @@ -0,0 +1,56 @@ + + + + net6.0-android;net6.0-ios;net6.0-maccatalyst + $(TargetFrameworks);net6.0-windows10.0.19041.0 + + + Exe + FormattingBug + true + true + enable + + + FormattingBug + + + com.companyname.formattingbug + C042A79B-F8AD-45F0-8512-4A689CA6F3B2 + + + 1.0 + 1 + + 14.2 + 14.0 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FormattingBug/FormattingBug.csproj.user b/FormattingBug/FormattingBug.csproj.user new file mode 100644 index 0000000..8d8c97e --- /dev/null +++ b/FormattingBug/FormattingBug.csproj.user @@ -0,0 +1,8 @@ + + + + net6.0-android + False + Pixel 5 - API 32 (Android 12.1 - API 32) + + \ No newline at end of file diff --git a/FormattingBug/MainPage.cs b/FormattingBug/MainPage.cs new file mode 100644 index 0000000..f5b744e --- /dev/null +++ b/FormattingBug/MainPage.cs @@ -0,0 +1,22 @@ +using CommunityToolkit.Maui.Markup; + +namespace FormattingBug; + +public class MainPage : ContentPage +{ + public MainPage() + { + BindingContext = new MainPageViewModel(); + + var testEntry = new Entry { Placeholder = "Money", HorizontalTextAlignment = TextAlignment.End, Keyboard = Keyboard.Numeric }; + testEntry.Bind(Entry.TextProperty, nameof(MainPageViewModel.EntryValue), BindingMode.TwoWay, new DecimalCurrencyConverter()); + Content = new StackLayout + { + Margin = new Thickness(50), + VerticalOptions = LayoutOptions.Center, + Children = { + testEntry + } + }; + } +} diff --git a/FormattingBug/MainPageViewModel.cs b/FormattingBug/MainPageViewModel.cs new file mode 100644 index 0000000..701fc35 --- /dev/null +++ b/FormattingBug/MainPageViewModel.cs @@ -0,0 +1,13 @@ +using CommunityToolkit.Mvvm.ComponentModel; + +namespace FormattingBug; + +public partial class MainPageViewModel : ObservableObject +{ + [ObservableProperty] + private decimal entryValue; + + public MainPageViewModel() + { + } +} diff --git a/FormattingBug/MauiProgram.cs b/FormattingBug/MauiProgram.cs new file mode 100644 index 0000000..acf144b --- /dev/null +++ b/FormattingBug/MauiProgram.cs @@ -0,0 +1,21 @@ +namespace FormattingBug; + +public static class MauiProgram +{ + public static MauiApp CreateMauiApp() + { + var builder = MauiApp.CreateBuilder(); + builder + .UseMauiApp() + .ConfigureFonts(fonts => + { + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); + fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); + }); + + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + + return builder.Build(); + } +} diff --git a/FormattingBug/Platforms/Android/AndroidManifest.xml b/FormattingBug/Platforms/Android/AndroidManifest.xml new file mode 100644 index 0000000..fb20840 --- /dev/null +++ b/FormattingBug/Platforms/Android/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/FormattingBug/Platforms/Android/MainActivity.cs b/FormattingBug/Platforms/Android/MainActivity.cs new file mode 100644 index 0000000..16c056a --- /dev/null +++ b/FormattingBug/Platforms/Android/MainActivity.cs @@ -0,0 +1,10 @@ +using Android.App; +using Android.Content.PM; +using Android.OS; + +namespace FormattingBug; + +[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] +public class MainActivity : MauiAppCompatActivity +{ +} diff --git a/FormattingBug/Platforms/Android/MainApplication.cs b/FormattingBug/Platforms/Android/MainApplication.cs new file mode 100644 index 0000000..83984f0 --- /dev/null +++ b/FormattingBug/Platforms/Android/MainApplication.cs @@ -0,0 +1,15 @@ +using Android.App; +using Android.Runtime; + +namespace FormattingBug; + +[Application] +public class MainApplication : MauiApplication +{ + public MainApplication(IntPtr handle, JniHandleOwnership ownership) + : base(handle, ownership) + { + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); +} diff --git a/FormattingBug/Platforms/Android/Resources/values/colors.xml b/FormattingBug/Platforms/Android/Resources/values/colors.xml new file mode 100644 index 0000000..c04d749 --- /dev/null +++ b/FormattingBug/Platforms/Android/Resources/values/colors.xml @@ -0,0 +1,6 @@ + + + #512BD4 + #2B0B98 + #2B0B98 + \ No newline at end of file diff --git a/FormattingBug/Platforms/MacCatalyst/AppDelegate.cs b/FormattingBug/Platforms/MacCatalyst/AppDelegate.cs new file mode 100644 index 0000000..deabe7e --- /dev/null +++ b/FormattingBug/Platforms/MacCatalyst/AppDelegate.cs @@ -0,0 +1,9 @@ +using Foundation; + +namespace FormattingBug; + +[Register("AppDelegate")] +public class AppDelegate : MauiUIApplicationDelegate +{ + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); +} diff --git a/FormattingBug/Platforms/MacCatalyst/Info.plist b/FormattingBug/Platforms/MacCatalyst/Info.plist new file mode 100644 index 0000000..c96dd0a --- /dev/null +++ b/FormattingBug/Platforms/MacCatalyst/Info.plist @@ -0,0 +1,30 @@ + + + + + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/FormattingBug/Platforms/MacCatalyst/Program.cs b/FormattingBug/Platforms/MacCatalyst/Program.cs new file mode 100644 index 0000000..9ea51e2 --- /dev/null +++ b/FormattingBug/Platforms/MacCatalyst/Program.cs @@ -0,0 +1,15 @@ +using ObjCRuntime; +using UIKit; + +namespace FormattingBug; + +public class Program +{ + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } +} diff --git a/FormattingBug/Platforms/Tizen/Main.cs b/FormattingBug/Platforms/Tizen/Main.cs new file mode 100644 index 0000000..b83641b --- /dev/null +++ b/FormattingBug/Platforms/Tizen/Main.cs @@ -0,0 +1,16 @@ +using System; +using Microsoft.Maui; +using Microsoft.Maui.Hosting; + +namespace FormattingBug; + +class Program : MauiApplication +{ + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + + static void Main(string[] args) + { + var app = new Program(); + app.Run(args); + } +} diff --git a/FormattingBug/Platforms/Tizen/tizen-manifest.xml b/FormattingBug/Platforms/Tizen/tizen-manifest.xml new file mode 100644 index 0000000..907ff50 --- /dev/null +++ b/FormattingBug/Platforms/Tizen/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + appicon.xhigh.png + + + + + http://tizen.org/privilege/internet + + + + \ No newline at end of file diff --git a/FormattingBug/Platforms/Windows/App.xaml b/FormattingBug/Platforms/Windows/App.xaml new file mode 100644 index 0000000..ae84d23 --- /dev/null +++ b/FormattingBug/Platforms/Windows/App.xaml @@ -0,0 +1,8 @@ + + + diff --git a/FormattingBug/Platforms/Windows/App.xaml.cs b/FormattingBug/Platforms/Windows/App.xaml.cs new file mode 100644 index 0000000..2d08a00 --- /dev/null +++ b/FormattingBug/Platforms/Windows/App.xaml.cs @@ -0,0 +1,24 @@ +using Microsoft.UI.Xaml; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace FormattingBug.WinUI; + +/// +/// Provides application-specific behavior to supplement the default Application class. +/// +public partial class App : MauiWinUIApplication +{ + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); +} + diff --git a/FormattingBug/Platforms/Windows/Package.appxmanifest b/FormattingBug/Platforms/Windows/Package.appxmanifest new file mode 100644 index 0000000..0cb469c --- /dev/null +++ b/FormattingBug/Platforms/Windows/Package.appxmanifest @@ -0,0 +1,33 @@ + + + + + + + User Name + + + + + + + + + + + + + + + + + + + + + + diff --git a/FormattingBug/Platforms/Windows/app.manifest b/FormattingBug/Platforms/Windows/app.manifest new file mode 100644 index 0000000..4a13230 --- /dev/null +++ b/FormattingBug/Platforms/Windows/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + diff --git a/FormattingBug/Platforms/iOS/AppDelegate.cs b/FormattingBug/Platforms/iOS/AppDelegate.cs new file mode 100644 index 0000000..deabe7e --- /dev/null +++ b/FormattingBug/Platforms/iOS/AppDelegate.cs @@ -0,0 +1,9 @@ +using Foundation; + +namespace FormattingBug; + +[Register("AppDelegate")] +public class AppDelegate : MauiUIApplicationDelegate +{ + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); +} diff --git a/FormattingBug/Platforms/iOS/Info.plist b/FormattingBug/Platforms/iOS/Info.plist new file mode 100644 index 0000000..0004a4f --- /dev/null +++ b/FormattingBug/Platforms/iOS/Info.plist @@ -0,0 +1,32 @@ + + + + + LSRequiresIPhoneOS + + UIDeviceFamily + + 1 + 2 + + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + XSAppIconAssets + Assets.xcassets/appicon.appiconset + + diff --git a/FormattingBug/Platforms/iOS/Program.cs b/FormattingBug/Platforms/iOS/Program.cs new file mode 100644 index 0000000..9ea51e2 --- /dev/null +++ b/FormattingBug/Platforms/iOS/Program.cs @@ -0,0 +1,15 @@ +using ObjCRuntime; +using UIKit; + +namespace FormattingBug; + +public class Program +{ + // This is the main entry point of the application. + static void Main(string[] args) + { + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); + } +} diff --git a/FormattingBug/Properties/launchSettings.json b/FormattingBug/Properties/launchSettings.json new file mode 100644 index 0000000..edf8aad --- /dev/null +++ b/FormattingBug/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "Windows Machine": { + "commandName": "MsixPackage", + "nativeDebugging": false + } + } +} \ No newline at end of file diff --git a/FormattingBug/Resources/Fonts/OpenSans-Regular.ttf b/FormattingBug/Resources/Fonts/OpenSans-Regular.ttf new file mode 100644 index 0000000..c9237de Binary files /dev/null and b/FormattingBug/Resources/Fonts/OpenSans-Regular.ttf differ diff --git a/FormattingBug/Resources/Fonts/OpenSans-Semibold.ttf b/FormattingBug/Resources/Fonts/OpenSans-Semibold.ttf new file mode 100644 index 0000000..0da9f99 Binary files /dev/null and b/FormattingBug/Resources/Fonts/OpenSans-Semibold.ttf differ diff --git a/FormattingBug/Resources/Images/dotnet_bot.svg b/FormattingBug/Resources/Images/dotnet_bot.svg new file mode 100644 index 0000000..abfaff2 --- /dev/null +++ b/FormattingBug/Resources/Images/dotnet_bot.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FormattingBug/Resources/Raw/AboutAssets.txt b/FormattingBug/Resources/Raw/AboutAssets.txt new file mode 100644 index 0000000..3f7a940 --- /dev/null +++ b/FormattingBug/Resources/Raw/AboutAssets.txt @@ -0,0 +1,14 @@ +Any raw assets you want to be deployed with your application can be placed in +this directory (and child directories) and given a Build Action of "MauiAsset": + + + +These files will be deployed with you package and will be accessible using Essentials: + + async Task LoadMauiAsset() + { + using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); + using var reader = new StreamReader(stream); + + var contents = reader.ReadToEnd(); + } diff --git a/FormattingBug/Resources/Styles.xaml b/FormattingBug/Resources/Styles.xaml new file mode 100644 index 0000000..0eb4369 --- /dev/null +++ b/FormattingBug/Resources/Styles.xaml @@ -0,0 +1,456 @@ + + + + + #512BD4 + #DFD8F7 + #2B0B98 + White + Black + #E5E5E1 + #969696 + #505050 + + + + + + + + + + #F7B548 + #FFD590 + #FFE5B9 + #28C2D1 + #7BDDEF + #C3F2F4 + #3E8EED + #72ACF1 + #A7CBF6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FormattingBug/Resources/appicon.svg b/FormattingBug/Resources/appicon.svg new file mode 100644 index 0000000..9d63b65 --- /dev/null +++ b/FormattingBug/Resources/appicon.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/FormattingBug/Resources/appiconfg.svg b/FormattingBug/Resources/appiconfg.svg new file mode 100644 index 0000000..21dfb25 --- /dev/null +++ b/FormattingBug/Resources/appiconfg.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/MauiBugs.sln b/MauiBugs.sln new file mode 100644 index 0000000..d04a871 --- /dev/null +++ b/MauiBugs.sln @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31611.283 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FormattingBug", "FormattingBug\FormattingBug.csproj", "{DAEF5E10-F148-4D64-BF07-325AE536A373}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DAEF5E10-F148-4D64-BF07-325AE536A373}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAEF5E10-F148-4D64-BF07-325AE536A373}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAEF5E10-F148-4D64-BF07-325AE536A373}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {DAEF5E10-F148-4D64-BF07-325AE536A373}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAEF5E10-F148-4D64-BF07-325AE536A373}.Release|Any CPU.Build.0 = Release|Any CPU + {DAEF5E10-F148-4D64-BF07-325AE536A373}.Release|Any CPU.Deploy.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572} + EndGlobalSection +EndGlobal