├── .gitattributes ├── .gitignore ├── LICENSE.txt ├── Maui.NullableDateTimePicker.Samples ├── App.xaml ├── App.xaml.cs ├── AppShell.xaml ├── AppShell.xaml.cs ├── MainPage.xaml ├── MainPage.xaml.cs ├── Maui.NullableDateTimePicker.Samples.csproj ├── MauiProgram.cs ├── NewPage.xaml ├── NewPage.xaml.cs ├── Platforms │ ├── Android │ │ ├── AndroidManifest.xml │ │ ├── MainActivity.cs │ │ ├── MainApplication.cs │ │ └── Resources │ │ │ └── values │ │ │ └── colors.xml │ ├── MacCatalyst │ │ ├── AppDelegate.cs │ │ ├── Info.plist │ │ └── Program.cs │ ├── Tizen │ │ ├── Main.cs │ │ └── tizen-manifest.xml │ ├── Windows │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── Package.appxmanifest │ │ └── app.manifest │ └── iOS │ │ ├── AppDelegate.cs │ │ ├── Info.plist │ │ └── Program.cs ├── Properties │ └── launchSettings.json └── Resources │ ├── AppIcon │ ├── appicon.svg │ └── appiconfg.svg │ ├── Fonts │ ├── OpenSans-Regular.ttf │ ├── OpenSans-Semibold.ttf │ └── fa-solid-900.ttf │ ├── Images │ └── dotnet_bot.svg │ ├── Raw │ └── AboutAssets.txt │ ├── Splash │ └── splash.svg │ └── Styles │ ├── Colors.xaml │ └── Styles.xaml ├── Maui.NullableDateTimePicker.sln ├── Maui.NullableDateTimePicker ├── AppBuilderExtensions.cs ├── AssemblyInfo.cs ├── Controls │ ├── NullableDateTimePickerEntry.cs │ └── NullableDateTimePickerSelectList.cs ├── DefaultStyles.cs ├── Enums │ ├── PickerModes.cs │ └── PopupButtons.cs ├── Helpers │ ├── MainThreadHelper.cs │ └── PopupResultTask.cs ├── Images │ ├── date_icon.png │ ├── date_time_icon.png │ └── time_icon.png ├── Interfaces │ └── INullableDateTimePickerOptions.cs ├── Maui.NullableDateTimePicker.csproj ├── Models │ ├── DateTimeChangedEventArgs.cs │ ├── MonthModel.cs │ ├── NullableDateTimePickerOptions.cs │ ├── PickerItem.cs │ ├── PopupResult.cs │ └── YearModel.cs ├── NullableDateTimePicker.cs └── Popup │ ├── NullableDateTimePickerContent.cs │ └── NullableDateTimePickerPopup.cs ├── README.md └── screenshot.png /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | **/bin/ 13 | **/obj/ 14 | 15 | # User-specific files (MonoDevelop/Xamarin Studio) 16 | *.userprefs 17 | 18 | # Mono auto generated files 19 | mono_crash.* 20 | 21 | # Build results 22 | [Dd]ebug/ 23 | [Dd]ebugPublic/ 24 | [Rr]elease/ 25 | [Rr]eleases/ 26 | x64/ 27 | x86/ 28 | [Ww][Ii][Nn]32/ 29 | [Aa][Rr][Mm]/ 30 | [Aa][Rr][Mm]64/ 31 | bld/ 32 | [Bb]in/ 33 | [Oo]bj/ 34 | [Oo]ut/ 35 | [Ll]og/ 36 | [Ll]ogs/ 37 | 38 | # Visual Studio 2015/2017 cache/options directory 39 | .vs/ 40 | # Uncomment if you have tasks that create the project's static files in wwwroot 41 | #wwwroot/ 42 | 43 | # Visual Studio 2017 auto generated files 44 | Generated\ Files/ 45 | 46 | # MSTest test Results 47 | [Tt]est[Rr]esult*/ 48 | [Bb]uild[Ll]og.* 49 | 50 | # NUnit 51 | *.VisualState.xml 52 | TestResult.xml 53 | nunit-*.xml 54 | 55 | # Build Results of an ATL Project 56 | [Dd]ebugPS/ 57 | [Rr]eleasePS/ 58 | dlldata.c 59 | 60 | # Benchmark Results 61 | BenchmarkDotNet.Artifacts/ 62 | 63 | # .NET Core 64 | project.lock.json 65 | project.fragment.lock.json 66 | artifacts/ 67 | 68 | # ASP.NET Scaffolding 69 | ScaffoldingReadMe.txt 70 | 71 | # StyleCop 72 | StyleCopReport.xml 73 | 74 | # Files built by Visual Studio 75 | *_i.c 76 | *_p.c 77 | *_h.h 78 | *.ilk 79 | *.meta 80 | *.obj 81 | *.iobj 82 | *.pch 83 | *.pdb 84 | *.ipdb 85 | *.pgc 86 | *.pgd 87 | *.rsp 88 | *.sbr 89 | *.tlb 90 | *.tli 91 | *.tlh 92 | *.tmp 93 | *.tmp_proj 94 | *_wpftmp.csproj 95 | *.log 96 | *.vspscc 97 | *.vssscc 98 | .builds 99 | *.pidb 100 | *.svclog 101 | *.scc 102 | 103 | # Chutzpah Test files 104 | _Chutzpah* 105 | 106 | # Visual C++ cache files 107 | ipch/ 108 | *.aps 109 | *.ncb 110 | *.opendb 111 | *.opensdf 112 | *.sdf 113 | *.cachefile 114 | *.VC.db 115 | *.VC.VC.opendb 116 | 117 | # Visual Studio profiler 118 | *.psess 119 | *.vsp 120 | *.vspx 121 | *.sap 122 | 123 | # Visual Studio Trace Files 124 | *.e2e 125 | 126 | # TFS 2012 Local Workspace 127 | $tf/ 128 | 129 | # Guidance Automation Toolkit 130 | *.gpState 131 | 132 | # ReSharper is a .NET coding add-in 133 | _ReSharper*/ 134 | *.[Rr]e[Ss]harper 135 | *.DotSettings.user 136 | 137 | # TeamCity is a build add-in 138 | _TeamCity* 139 | 140 | # DotCover is a Code Coverage Tool 141 | *.dotCover 142 | 143 | # AxoCover is a Code Coverage Tool 144 | .axoCover/* 145 | !.axoCover/settings.json 146 | 147 | # Coverlet is a free, cross platform Code Coverage Tool 148 | coverage*.json 149 | coverage*.xml 150 | coverage*.info 151 | 152 | # Visual Studio code coverage results 153 | *.coverage 154 | *.coveragexml 155 | 156 | # NCrunch 157 | _NCrunch_* 158 | .*crunch*.local.xml 159 | nCrunchTemp_* 160 | 161 | # MightyMoose 162 | *.mm.* 163 | AutoTest.Net/ 164 | 165 | # Web workbench (sass) 166 | .sass-cache/ 167 | 168 | # Installshield output folder 169 | [Ee]xpress/ 170 | 171 | # DocProject is a documentation generator add-in 172 | DocProject/buildhelp/ 173 | DocProject/Help/*.HxT 174 | DocProject/Help/*.HxC 175 | DocProject/Help/*.hhc 176 | DocProject/Help/*.hhk 177 | DocProject/Help/*.hhp 178 | DocProject/Help/Html2 179 | DocProject/Help/html 180 | 181 | # Click-Once directory 182 | publish/ 183 | 184 | # Publish Web Output 185 | *.[Pp]ublish.xml 186 | *.azurePubxml 187 | # Note: Comment the next line if you want to checkin your web deploy settings, 188 | # but database connection strings (with potential passwords) will be unencrypted 189 | *.pubxml 190 | *.publishproj 191 | 192 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 193 | # checkin your Azure Web App publish settings, but sensitive information contained 194 | # in these scripts will be unencrypted 195 | PublishScripts/ 196 | 197 | # NuGet Packages 198 | *.nupkg 199 | # NuGet Symbol Packages 200 | *.snupkg 201 | # The packages folder can be ignored because of Package Restore 202 | **/[Pp]ackages/* 203 | # except build/, which is used as an MSBuild target. 204 | !**/[Pp]ackages/build/ 205 | # Uncomment if necessary however generally it will be regenerated when needed 206 | #!**/[Pp]ackages/repositories.config 207 | # NuGet v3's project.json files produces more ignorable files 208 | *.nuget.props 209 | *.nuget.targets 210 | 211 | # Microsoft Azure Build Output 212 | csx/ 213 | *.build.csdef 214 | 215 | # Microsoft Azure Emulator 216 | ecf/ 217 | rcf/ 218 | 219 | # Windows Store app package directories and files 220 | AppPackages/ 221 | BundleArtifacts/ 222 | Package.StoreAssociation.xml 223 | _pkginfo.txt 224 | *.appx 225 | *.appxbundle 226 | *.appxupload 227 | 228 | # Visual Studio cache files 229 | # files ending in .cache can be ignored 230 | *.[Cc]ache 231 | # but keep track of directories ending in .cache 232 | !?*.[Cc]ache/ 233 | 234 | # Others 235 | ClientBin/ 236 | ~$* 237 | *~ 238 | *.dbmdl 239 | *.dbproj.schemaview 240 | *.jfm 241 | *.pfx 242 | *.publishsettings 243 | orleans.codegen.cs 244 | 245 | # Including strong name files can present a security risk 246 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 247 | #*.snk 248 | 249 | # Since there are multiple workflows, uncomment next line to ignore bower_components 250 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 251 | #bower_components/ 252 | 253 | # RIA/Silverlight projects 254 | Generated_Code/ 255 | 256 | # Backup & report files from converting an old project file 257 | # to a newer Visual Studio version. Backup files are not needed, 258 | # because we have git ;-) 259 | _UpgradeReport_Files/ 260 | Backup*/ 261 | UpgradeLog*.XML 262 | UpgradeLog*.htm 263 | ServiceFabricBackup/ 264 | *.rptproj.bak 265 | 266 | # SQL Server files 267 | *.mdf 268 | *.ldf 269 | *.ndf 270 | 271 | # Business Intelligence projects 272 | *.rdl.data 273 | *.bim.layout 274 | *.bim_*.settings 275 | *.rptproj.rsuser 276 | *- [Bb]ackup.rdl 277 | *- [Bb]ackup ([0-9]).rdl 278 | *- [Bb]ackup ([0-9][0-9]).rdl 279 | 280 | # Microsoft Fakes 281 | FakesAssemblies/ 282 | 283 | # GhostDoc plugin setting file 284 | *.GhostDoc.xml 285 | 286 | # Node.js Tools for Visual Studio 287 | .ntvs_analysis.dat 288 | node_modules/ 289 | 290 | # Visual Studio 6 build log 291 | *.plg 292 | 293 | # Visual Studio 6 workspace options file 294 | *.opt 295 | 296 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 297 | *.vbw 298 | 299 | # Visual Studio LightSwitch build output 300 | **/*.HTMLClient/GeneratedArtifacts 301 | **/*.DesktopClient/GeneratedArtifacts 302 | **/*.DesktopClient/ModelManifest.xml 303 | **/*.Server/GeneratedArtifacts 304 | **/*.Server/ModelManifest.xml 305 | _Pvt_Extensions 306 | 307 | # Paket dependency manager 308 | .paket/paket.exe 309 | paket-files/ 310 | 311 | # FAKE - F# Make 312 | .fake/ 313 | 314 | # CodeRush personal settings 315 | .cr/personal 316 | 317 | # Python Tools for Visual Studio (PTVS) 318 | __pycache__/ 319 | *.pyc 320 | 321 | # Cake - Uncomment if you are using it 322 | # tools/** 323 | # !tools/packages.config 324 | 325 | # Tabs Studio 326 | *.tss 327 | 328 | # Telerik's JustMock configuration file 329 | *.jmconfig 330 | 331 | # BizTalk build output 332 | *.btp.cs 333 | *.btm.cs 334 | *.odx.cs 335 | *.xsd.cs 336 | 337 | # OpenCover UI analysis results 338 | OpenCover/ 339 | 340 | # Azure Stream Analytics local run output 341 | ASALocalRun/ 342 | 343 | # MSBuild Binary and Structured Log 344 | *.binlog 345 | 346 | # NVidia Nsight GPU debugger configuration file 347 | *.nvuser 348 | 349 | # MFractors (Xamarin productivity tool) working folder 350 | .mfractor/ 351 | 352 | # Local History for Visual Studio 353 | .localhistory/ 354 | 355 | # BeatPulse healthcheck temp database 356 | healthchecksdb 357 | 358 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 359 | MigrationBackup/ 360 | 361 | # Ionide (cross platform F# VS Code tools) working folder 362 | .ionide/ 363 | 364 | # Fody - auto-generated XML schema 365 | FodyWeavers.xsd 366 | .idea 367 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Maui.NullableDateTimePicker.Samples/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Maui.NullableDateTimePicker.Samples/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Maui.NullableDateTimePicker.Samples 2 | { 3 | public partial class App : Application 4 | { 5 | public App() 6 | { 7 | InitializeComponent(); 8 | 9 | MainPage = new AppShell(); 10 | 11 | // Register a handler for unhandled XAML exceptions 12 | 13 | AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; 14 | } 15 | 16 | 17 | // Handler for unhandled XAML exceptions 18 | private void OnUnhandledException(object sender, UnhandledExceptionEventArgs args) 19 | { 20 | // Handle the exception here 21 | Exception exception = (Exception)args.ExceptionObject; 22 | Console.WriteLine($"Unhandled exception occurred: {exception}"); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Maui.NullableDateTimePicker.Samples/AppShell.xaml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Maui.NullableDateTimePicker.Samples/AppShell.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Maui.NullableDateTimePicker.Samples 2 | { 3 | public partial class AppShell : Shell 4 | { 5 | public AppShell() 6 | { 7 | InitializeComponent(); 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /Maui.NullableDateTimePicker.Samples/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /Maui.NullableDateTimePicker.Samples/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | 3 | namespace Maui.NullableDateTimePicker.Samples; 4 | 5 | public partial class MainPage : ContentPage 6 | { 7 | public MainPage() 8 | { 9 | BindingContext = this; 10 | InitializeComponent(); 11 | themeSwitch.IsToggled = Application.Current.RequestedTheme == AppTheme.Dark; 12 | 13 | // Create Datetimepicker Programmatically 14 | CreateDateTimePickerProgrammatically(); 15 | } 16 | 17 | 18 | DateTime? myDateTime = DateTime.Now; 19 | public DateTime? MyDateTime 20 | { 21 | get => myDateTime; 22 | set 23 | { 24 | myDateTime = value; 25 | OnPropertyChanged(nameof(MyDateTime)); 26 | } 27 | } 28 | 29 | public bool Is12HourFormat => System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("tt"); 30 | 31 | private ICommand _OpenModalCommand; 32 | public ICommand OpenModalCommand => _OpenModalCommand ??= new Command(async () => await Navigation.PushModalAsync(new NavigationPage(new NewPage()))); 33 | 34 | // Datepicker programmatically 35 | private void CreateDateTimePickerProgrammatically() 36 | { 37 | NullableDateTimePicker datePicker = new() 38 | { 39 | Mode = PickerModes.Date, 40 | Format = Thread.CurrentThread.CurrentUICulture.DateTimeFormat.ShortDatePattern, 41 | ShowWeekNumbers = true, 42 | ShowOtherMonthDays = true, 43 | HorizontalOptions = LayoutOptions.Fill, 44 | VerticalOptions = LayoutOptions.Center 45 | }; 46 | 47 | datePicker.SetAppThemeColor(NullableDateTimePicker.ForeColorProperty, Colors.Black, Colors.White); 48 | datePicker.SetAppThemeColor(NullableDateTimePicker.BodyBackgroundColorProperty, Colors.White, Colors.Black); 49 | 50 | 51 | // binding 52 | datePicker.BindingContext = this; 53 | datePicker.SetBinding(NullableDateTimePicker.NullableDateTimeProperty, nameof(MyDateTime), BindingMode.TwoWay); 54 | 55 | DateTimePlaceStackLayout.Add(datePicker); 56 | } 57 | 58 | 59 | // Calling nullabledatetimepicker calendar popup directly with own entry and button 60 | private async void DateTimePicker_Clicked(object sender, EventArgs e) 61 | { 62 | INullableDateTimePickerOptions nullableDateTimePickerOptions = new NullableDateTimePickerOptions 63 | { 64 | NullableDateTime = MyDateTime, 65 | Mode = PickerModes.DateTime, 66 | ShowWeekNumbers = true, 67 | CloseOnOutsideClick = true, 68 | PopupBorderCornerRadius = 10, 69 | PopupBorderThemeColor = new CommunityToolkit.Maui.AppThemeColor 70 | { 71 | Light = Colors.Black, 72 | Dark = Colors.White, 73 | }, 74 | PopupBorderWidth = 1, 75 | PopupPadding = 5, 76 | }; 77 | 78 | var result = await NullableDateTimePicker.OpenCalendarAsync(nullableDateTimePickerOptions); 79 | if (result is PopupResult popupResult && popupResult.ButtonResult != PopupButtons.Cancel) 80 | { 81 | MyDateTime = popupResult.NullableDateTime; 82 | //DateTimeEntry.Text = popupResult.NullableDateTime?.ToString("g"); //If you are not using ViewModel 83 | } 84 | } 85 | 86 | public DateTime? MyMinDate => new DateTime(DateTime.Now.Year, DateTime.Now.Month, 10); 87 | public DateTime? MyMaxDate => new DateTime(DateTime.Now.Year, DateTime.Now.Month, 20); 88 | 89 | private void OnThemeToggled(object sender, ToggledEventArgs e) 90 | { 91 | bool isDarkMode = e.Value; 92 | 93 | App.Current.UserAppTheme = isDarkMode ? AppTheme.Dark : AppTheme.Light; 94 | } 95 | } 96 | 97 | static class IconFont 98 | { 99 | public const string Calendar = "\uf133"; 100 | public const string CalendarDay = "\uf783"; 101 | public const string CalendarDays = "\uf073"; 102 | } -------------------------------------------------------------------------------- /Maui.NullableDateTimePicker.Samples/Maui.NullableDateTimePicker.Samples.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net9.0-android;net9.0-ios;net9.0-maccatalyst 5 | $(TargetFrameworks);net9.0-windows10.0.19041.0 6 | 7 | 8 | Exe 9 | Maui.NullableDateTimePicker.Samples 10 | true 11 | true 12 | enable 13 | 14 | 15 | Maui.NullableDateTimePicker.Samples 16 | 17 | 18 | com.companyname.Maui.NullableDateTimePicker.Samples 19 | 0ca67e9a-2d25-41f0-9470-9e5c7d792cd6 20 | 21 | 22 | 1.0 23 | 1 24 | 25 | 26 | 27 | 28 | 15.0 29 | 15.0 30 | 21.0 31 | 10.0.17763.0 32 | 10.0.17763.0 33 | 6.5 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | MSBuild:Compile 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Maui.NullableDateTimePicker.Samples/MauiProgram.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Maui; 2 | using Microsoft.Extensions.Logging; 3 | using Microsoft.Maui.Platform; 4 | 5 | namespace Maui.NullableDateTimePicker.Samples 6 | { 7 | public static class MauiProgram 8 | { 9 | public static MauiApp CreateMauiApp() 10 | { 11 | var builder = MauiApp.CreateBuilder(); 12 | builder.UseMauiApp(); 13 | builder.UseMauiCommunityToolkit(); 14 | builder.ConfigureNullableDateTimePicker() 15 | .ConfigureFonts(fonts => 16 | { 17 | fonts.AddFont("fa-solid-900.ttf", "FontAwesome"); 18 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); 19 | fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); 20 | }); 21 | #if DEBUG 22 | builder.Logging.AddDebug(); 23 | #endif 24 | 25 | // Remove Entry control underline, padding and background color 26 | Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("NullableDateTimePickerEntryCustomization", (handler, view) => 27 | { 28 | if (view is Maui.NullableDateTimePicker.NullableDateTimePickerEntry) 29 | { 30 | #if ANDROID 31 | handler.PlatformView.SetBackgroundColor(Android.Graphics.Color.Transparent); 32 | handler.PlatformView.SetPadding(0, 0, 0, 0); 33 | #if NET8_0_OR_GREATER 34 | handler.PlatformView.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(view.Background.ToColor().ToPlatform()); 35 | #endif 36 | #elif IOS || MACCATALYST 37 | handler.PlatformView.BackgroundColor = Colors.Transparent.ToPlatform(); 38 | handler.PlatformView.BorderStyle = UIKit.UITextBorderStyle.None; 39 | #elif WINDOWS 40 | //handler.PlatformView.Background = Colors.Transparent.ToPlatform(); 41 | handler.PlatformView.Background = view.Background.ToColor().ToPlatform(); 42 | handler.PlatformView.Padding = new Microsoft.UI.Xaml.Thickness(0); 43 | handler.PlatformView.BorderThickness = new Microsoft.UI.Xaml.Thickness() 44 | { 45 | Bottom = 0, 46 | Top = 0, 47 | Left = 0, 48 | Right = 0, 49 | }; 50 | #endif 51 | } 52 | }); 53 | 54 | return builder.Build(); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Maui.NullableDateTimePicker.Samples/NewPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 15 |