Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DateEditorControl.cs « Controls « Xamarin.PropertyEditing.Mac - github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7249f0d551fbd77639a9ce170136e1a5c4b8b8b3 (plain)
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
using System;
using AppKit;
using Xamarin.PropertyEditing.Common;

namespace Xamarin.PropertyEditing.Mac
{
	internal class DateEditorControl : BaseDateTimeEditorControl<Date>
	{

		public DateEditorControl (IHostResourceProvider hostResources)
			: base (hostResources)
		{
			DatePicker.DatePickerElements = NSDatePickerElementFlags.YearMonthDateDay;
		}

		protected override void Editor_Activated (object sender, EventArgs e)
		{
			ViewModel.Value = new Date (DatePicker.DateValue.ToDateTime ());
		}

		protected override void UpdateValue ()
		{
			if (ViewModel.Value != null)
				DatePicker.DateValue = ViewModel.Value.DateTime.ToNSDate ();
		}
	}
}