wxr
2020-06-15 b8e94316e41eba72d927d5ca7d931b26139ee8ff
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
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
66
67
68
69
70
71
72
73
74
using Android.Content;
using Android.Runtime;
using Android.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.Views;
 
namespace Shared
{
    /// <summary>
    /// 日期视图
    /// </summary>
    public class DateView : View
    {
        /// <summary>
        /// 当前视图
        /// </summary>
        /// <value>The android text.</value>
        AndroidDatePicker currentAndroidDatePicker
        {
            get
            {
                return AndroidView as AndroidDatePicker;
            }
            set
            {
                AndroidView = value;
            }
        }
 
 
        /// <summary>
        /// 年
        /// </summary>
        public int Year
        {
            get { return currentAndroidDatePicker.Year; }
        }
        /// <summary>
        /// 月
        /// </summary>
        public int Month
        {
            get { return currentAndroidDatePicker.Month; }
        }
        /// <summary>
        /// 天
        /// </summary>
        public int Day
        {
            get { return currentAndroidDatePicker.DayOfMonth; }
        }
 
        /// <summary>
        /// 实例
        /// </summary>
        public DateView()
        {
            currentAndroidDatePicker = new AndroidDatePicker(Application.Activity);
        }
 
        /// <summary>
        /// Android 原生 AndroidDatePicker
        /// </summary>
        class AndroidDatePicker : Android.Widget.DatePicker
        {
            public AndroidDatePicker(Context context)
                : base(context)
            { }
        }
    }
}