Karamunting.Android.Drawers.SpinnerDatePicker 1.0.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package Karamunting.Android.Drawers.SpinnerDatePicker --version 1.0.6                
NuGet\Install-Package Karamunting.Android.Drawers.SpinnerDatePicker -Version 1.0.6                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Karamunting.Android.Drawers.SpinnerDatePicker" Version="1.0.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Karamunting.Android.Drawers.SpinnerDatePicker --version 1.0.6                
#r "nuget: Karamunting.Android.Drawers.SpinnerDatePicker, 1.0.6"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Karamunting.Android.Drawers.SpinnerDatePicker as a Cake Addin
#addin nuget:?package=Karamunting.Android.Drawers.SpinnerDatePicker&version=1.0.6

// Install Karamunting.Android.Drawers.SpinnerDatePicker as a Cake Tool
#tool nuget:?package=Karamunting.Android.Drawers.SpinnerDatePicker&version=1.0.6                

Usage

// Created by Rofiq Setiawan (rofiqsetiawan@gmail.com)

using System;
using Android.App;
using Android.OS;
using Android.Support.V7.App;
using Android.Util;
using Android.Widget;
using Tsongkha.SpinnerDatePicker;
using DatePickerDialog = Tsongkha.SpinnerDatePicker.DatePickerDialog;
using R = SpinnerDatePickerDemo.Resource;

namespace SpinnerDatePickerDemo
{
    [Activity(Label = "SpinnerDatePicker", MainLauncher = true, Icon = "@mipmap/ic_launcher", Theme = "@style/AppTheme")]
    public class MainActivity : AppCompatActivity
    {
        private const string MyTag = nameof(MainActivity);

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(R.Layout.activity_main);

            // Set Listener
            FindViewById<Button>(R.Id.set_date_button).Click += (s, e) =>
            {
                new SpinnerDatePickerDialogBuilder()
                    .Context(this)
                    .Callback(new DatePickerDialog.OnDateSetListener(
                        (Tsongkha.SpinnerDatePicker.DatePicker picker, int year, int month, int day) =>
                        {
                            var message = $"Selected date (yyyy-mm-dd) = y{year}-m{month}-d{day}";

                            Log.Warn(MyTag, message);
                            Toast.MakeText(this, message, ToastLength.Short).Show();
                        }
                    ))
                    .SpinnerTheme(R.Style.DatePickerSpinner)
                    //.DefaultDate(year: 2018, monthIndexedFromZero: 7, day: 31) // 0-index month! 0-11
                    .DefaultDate(new DateTime(year: 2018, month: 8, day: 31)) // Use this
                    .Build()
                    .Show();
            };


            // Event Handler
            FindViewById<Button>(R.Id.set_date_button_event_handler).Click += (s, e) =>
            {
                // If date not set, it will shows 1 January 2018
                var datePicker = new SpinnerDatePickerDialogBuilder()
                    .Context(this)
                    .SpinnerTheme(R.Style.DatePickerSpinner)
                    .DefaultDate(new DateTime(year: 2012, month: 12, day: 12))
                    .Build();

                datePicker.DateSet += (sender, args) =>
                {
                    var message = $"Selected date (yyyy-mm-dd) = y{args.Date.Year}-m{args.Date.Month}-d{args.Date.Day}";

                    Log.Warn(MyTag + ": EventHandler => ", message);
                    Toast.MakeText(this, message, ToastLength.Short).Show();
                };

                datePicker.Show();
            };
        }
    }
}
Product Compatible and additional computed target framework versions.
MonoAndroid monoandroid50 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • MonoAndroid 5.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 3,744 4/20/2020
2.0.1 3,571 9/25/2019
1.0.6.1 1,294 2/6/2019
1.0.6 2,151 5/17/2018
0.0.4 1,344 10/17/2017