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

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Louis <dolouis@microsoft.com>2020-10-08 18:09:21 +0300
committerGitHub <noreply@github.com>2020-10-08 18:09:21 +0300
commitd820cccf8bb64a27b02cea4d9ad72a742dc4eb8f (patch)
treed43772fd3d8f19312cb7cbe20409e53c7be5cff2
parent322d6c8f8298d519c94bad0f745b53bc2ebfed1f (diff)
Refactor to have individual Date and Time Controls for better mapping… (#756)
* Refactor to have individual Date and Time Controls for better mapping for .Forms * Add default control mapping to the TypeMap * Call our initialise value method. * Use custom controls and converters for our custom Date/Time * Let's return the 'broken' string, if an error occurs, until they correct it.
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/BaseDateTimeEditorControl.cs58
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/DateEditorControl.cs27
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs55
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/TimeEditorControl.cs27
-rw-r--r--Xamarin.PropertyEditing.Mac/PropertyEditorSelector.cs3
-rw-r--r--Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs9
-rw-r--r--Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs1
-rw-r--r--Xamarin.PropertyEditing.Windows/DateEditorControl.cs12
-rw-r--r--Xamarin.PropertyEditing.Windows/DateToTextConverter.cs32
-rw-r--r--Xamarin.PropertyEditing.Windows/EditorPropertySelector.cs7
-rw-r--r--Xamarin.PropertyEditing.Windows/Themes/Resources.xaml34
-rw-r--r--Xamarin.PropertyEditing.Windows/TimeEditorControl.cs12
-rw-r--r--Xamarin.PropertyEditing.Windows/TimeToTextConverter.cs32
-rw-r--r--Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj450
-rw-r--r--Xamarin.PropertyEditing/Common/Date.cs60
-rw-r--r--Xamarin.PropertyEditing/Common/Time.cs59
-rw-r--r--Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs2
17 files changed, 605 insertions, 275 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/BaseDateTimeEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/BaseDateTimeEditorControl.cs
new file mode 100644
index 0000000..795c44e
--- /dev/null
+++ b/Xamarin.PropertyEditing.Mac/Controls/BaseDateTimeEditorControl.cs
@@ -0,0 +1,58 @@
+using System;
+using AppKit;
+using Xamarin.PropertyEditing.ViewModels;
+
+namespace Xamarin.PropertyEditing.Mac
+{
+ internal abstract class BaseDateTimeEditorControl<T> : PropertyEditorControl<PropertyViewModel<T>>
+ {
+ public NSDatePicker DatePicker { get; }
+
+ public BaseDateTimeEditorControl (IHostResourceProvider hostResources)
+ : base (hostResources)
+ {
+ DatePicker = new NSDatePicker {
+ ControlSize = NSControlSize.Small,
+ DatePickerElements = NSDatePickerElementFlags.HourMinuteSecond | NSDatePickerElementFlags.YearMonthDateDay,
+ DatePickerStyle = NSDatePickerStyle.TextFieldAndStepper,
+ Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
+ TimeZone = Foundation.NSTimeZone.FromAbbreviation ("UTC"),
+ TranslatesAutoresizingMaskIntoConstraints = false,
+ };
+
+ // update the value on keypress
+ DatePicker.Activated += Editor_Activated;
+
+ AddSubview (DatePicker);
+
+ AddConstraints (new[] {
+ NSLayoutConstraint.Create (DatePicker, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f),
+ NSLayoutConstraint.Create (DatePicker, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1f, 0f),
+ NSLayoutConstraint.Create (DatePicker, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, 0),
+ NSLayoutConstraint.Create (DatePicker, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1f, -6f),
+ });
+ }
+
+ protected abstract void Editor_Activated (object sender, EventArgs e);
+
+ public override NSView FirstKeyView => DatePicker;
+ public override NSView LastKeyView => DatePicker;
+
+ protected override void SetEnabled ()
+ {
+ DatePicker.Enabled = ViewModel.Property.CanWrite;
+ }
+
+ protected override void UpdateAccessibilityValues ()
+ {
+ DatePicker.AccessibilityTitle = string.Format (Properties.Resources.AccessibilityDateTime, ViewModel.Property.Name);
+ DatePicker.Enabled = DatePicker.Enabled;
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ DatePicker.Activated -= Editor_Activated;
+ base.Dispose (disposing);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.PropertyEditing.Mac/Controls/DateEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/DateEditorControl.cs
new file mode 100644
index 0000000..7249f0d
--- /dev/null
+++ b/Xamarin.PropertyEditing.Mac/Controls/DateEditorControl.cs
@@ -0,0 +1,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 ();
+ }
+ }
+}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs
index 36532e2..53874ae 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/DateTimeEditorControl.cs
@@ -1,65 +1,22 @@
using System;
-using AppKit;
-using Xamarin.PropertyEditing.ViewModels;
namespace Xamarin.PropertyEditing.Mac
{
- internal class DateTimeEditorControl : PropertyEditorControl<PropertyViewModel<DateTime>>
- {
- private readonly NSDatePicker datePicker;
-
+ internal class DateTimeEditorControl : BaseDateTimeEditorControl<DateTime>
+ {
public DateTimeEditorControl (IHostResourceProvider hostResources)
: base (hostResources)
- {
- this.datePicker = new NSDatePicker {
- ControlSize = NSControlSize.Small,
- DatePickerElements = NSDatePickerElementFlags.HourMinuteSecond | NSDatePickerElementFlags.YearMonthDateDay,
- DatePickerStyle = NSDatePickerStyle.TextFieldAndStepper,
- Font = NSFont.SystemFontOfSize (NSFont.SystemFontSizeForControlSize (NSControlSize.Small)),
- TranslatesAutoresizingMaskIntoConstraints = false
- };
-
- // update the value on keypress
- this.datePicker.Activated += Editor_Activated;
-
- AddSubview (this.datePicker);
-
- AddConstraints (new[] {
- NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal, this, NSLayoutAttribute.CenterY, 1f, 0f),
- NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, this, NSLayoutAttribute.Leading, 1f, 0f),
- NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.Width, NSLayoutRelation.Equal, this, NSLayoutAttribute.Width, 1f, 0),
- NSLayoutConstraint.Create (this.datePicker, NSLayoutAttribute.Height, NSLayoutRelation.Equal, this, NSLayoutAttribute.Height, 1f, -6f),
- });
- }
-
- private void Editor_Activated (object sender, EventArgs e)
{
- ViewModel.Value = this.datePicker.DateValue.ToDateTime ();
}
-
- public override NSView FirstKeyView => this.datePicker;
- public override NSView LastKeyView => this.datePicker;
- protected override void UpdateValue ()
- {
- this.datePicker.DateValue = ViewModel.Value.ToNSDate ();
- }
-
- protected override void SetEnabled ()
+ protected override void Editor_Activated (object sender, EventArgs e)
{
- this.datePicker.Enabled = ViewModel.Property.CanWrite;
- }
-
- protected override void UpdateAccessibilityValues ()
- {
- this.datePicker.AccessibilityTitle = string.Format (Properties.Resources.AccessibilityDateTime, ViewModel.Property.Name);
- this.datePicker.Enabled = this.datePicker.Enabled;
+ ViewModel.Value = DatePicker.DateValue.ToDateTime ();
}
- protected override void Dispose (bool disposing)
+ protected override void UpdateValue ()
{
- this.datePicker.Activated -= Editor_Activated;
- base.Dispose (disposing);
+ DatePicker.DateValue = ViewModel.Value.ToNSDate ();
}
}
}
diff --git a/Xamarin.PropertyEditing.Mac/Controls/TimeEditorControl.cs b/Xamarin.PropertyEditing.Mac/Controls/TimeEditorControl.cs
new file mode 100644
index 0000000..f4ccd3b
--- /dev/null
+++ b/Xamarin.PropertyEditing.Mac/Controls/TimeEditorControl.cs
@@ -0,0 +1,27 @@
+using System;
+using AppKit;
+using Xamarin.PropertyEditing.Common;
+
+namespace Xamarin.PropertyEditing.Mac
+{
+ internal class TimeEditorControl : BaseDateTimeEditorControl<Time>
+ {
+ public TimeEditorControl (IHostResourceProvider hostResources)
+ : base (hostResources)
+ {
+ DatePicker.DatePickerElements = NSDatePickerElementFlags.HourMinuteSecond;
+ }
+
+ protected override void Editor_Activated (object sender, EventArgs e)
+ {
+ ViewModel.Value = new Time (DatePicker.DateValue.ToDateTime ());
+ }
+
+
+ protected override void UpdateValue ()
+ {
+ if (ViewModel.Value != null)
+ DatePicker.DateValue = ViewModel.Value.DateTime.ToNSDate ();
+ }
+ }
+}
diff --git a/Xamarin.PropertyEditing.Mac/PropertyEditorSelector.cs b/Xamarin.PropertyEditing.Mac/PropertyEditorSelector.cs
index bff6d97..fc73b36 100644
--- a/Xamarin.PropertyEditing.Mac/PropertyEditorSelector.cs
+++ b/Xamarin.PropertyEditing.Mac/PropertyEditorSelector.cs
@@ -61,7 +61,8 @@ namespace Xamarin.PropertyEditing.Mac
{typeof (ObjectPropertyViewModel), typeof (ObjectEditorControl)},
{typeof (TypePropertyViewModel), typeof (TypeEditorControl)},
{typeof (CollectionPropertyViewModel), typeof (CollectionInlineEditorControl)},
-
+ {typeof (PropertyViewModel<Date>), typeof (DateEditorControl)},
+ {typeof (PropertyViewModel<Time>), typeof (TimeEditorControl)},
};
}
}
diff --git a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs
index 991ef5b..c1eb8cb 100644
--- a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs
+++ b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs
@@ -102,7 +102,11 @@ namespace Xamarin.PropertyEditing.Tests.MockControls
AddProperty<FilePath> ("FilePath", ReadWrite, valueSources: ValueSources.Local | ValueSources.Resource | ValueSources.Binding);
AddReadOnlyProperty<FilePath> ("ReadOnlyFilePath", ReadOnly);
AddProperty<DateTime> ("DateTime", ReadWrite, valueSources: ValueSources.Local | ValueSources.Resource | ValueSources.Binding);
- AddReadOnlyProperty<DateTime> ("ReadDateTime", ReadOnly);
+ AddReadOnlyProperty<DateTime> ("ReadOnlyDateTime", ReadOnly);
+ AddProperty<Date> ("Date", ReadWrite, valueSources: ValueSources.Local | ValueSources.Resource | ValueSources.Binding);
+ AddReadOnlyProperty<Date> ("ReadOnlyDate", ReadOnly);
+ AddProperty<Time> ("Time", ReadWrite, valueSources: ValueSources.Local | ValueSources.Resource | ValueSources.Binding);
+ AddReadOnlyProperty<Time> ("ReadOnlyTime", ReadOnly);
AddEvents ("Click", "Hover", "Focus");
@@ -140,6 +144,9 @@ namespace Xamarin.PropertyEditing.Tests.MockControls
public async Task SetInitialValuesAsync (IObjectEditor editor)
{
await editor.SetValueAsync (Properties["FilePath"], new ValueInfo<FilePath> { Value = new FilePath ("/Desktop/MyTestFile") });
+ await editor.SetValueAsync (Properties["DateTime"], new ValueInfo<DateTime> { Value = DateTime.Now });
+ await editor.SetValueAsync (Properties["Date"], new ValueInfo<Date> { Value = new Date (DateTime.Now) });
+ await editor.SetValueAsync (Properties["Time"], new ValueInfo<Time> { Value = new Time (DateTime.Now) });
}
public async Task SetBrushInitialValueAsync (IObjectEditor editor, CommonBrush brush)
diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs
index 246c70d..e0e63ce 100644
--- a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs
+++ b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs
@@ -64,6 +64,7 @@ namespace Xamarin.PropertyEditing.Windows.Standalone
inspectedObject = mockedControl.MockedControl;
if (mockedControl is MockedSampleControlButton mockedButton) {
IObjectEditor editor = await this.panel.TargetPlatform.EditorProvider.GetObjectEditorAsync (inspectedObject);
+ await mockedButton.MockedControl.SetInitialValuesAsync (editor);
await mockedButton.MockedControl.SetBrushInitialValueAsync (editor, new CommonSolidBrush (20, 120, 220, 240, "sRGB"));
await mockedButton.MockedControl.SetMaterialDesignBrushInitialValueAsync (editor, new CommonSolidBrush (0x65, 0x1F, 0xFF, 200));
await mockedButton.MockedControl.SetReadOnlyBrushInitialValueAsync (editor, new CommonSolidBrush (240, 220, 15, 190));
diff --git a/Xamarin.PropertyEditing.Windows/DateEditorControl.cs b/Xamarin.PropertyEditing.Windows/DateEditorControl.cs
new file mode 100644
index 0000000..d93fd0f
--- /dev/null
+++ b/Xamarin.PropertyEditing.Windows/DateEditorControl.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.PropertyEditing.Windows
+{
+ class DateEditorControl : PropertyEditorControl
+ {
+ }
+}
diff --git a/Xamarin.PropertyEditing.Windows/DateToTextConverter.cs b/Xamarin.PropertyEditing.Windows/DateToTextConverter.cs
new file mode 100644
index 0000000..1c9dd63
--- /dev/null
+++ b/Xamarin.PropertyEditing.Windows/DateToTextConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Xamarin.PropertyEditing.Common;
+
+namespace Xamarin.PropertyEditing.Windows
+{
+ [ValueConversion (typeof (Date), typeof (string))]
+ internal class DateToTextConverter : MarkupExtension, IValueConverter
+ {
+ public object Convert (object value, Type targetType, object parameter, CultureInfo culture)
+ => !(value is Date dateValue) ? DependencyProperty.UnsetValue
+ : dateValue.ToString ();
+
+ public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is string dateValue) {
+ var parsedValue = Date.Parse (dateValue);
+ if (parsedValue != null)
+ return parsedValue;
+ else
+ return value;
+ } else {
+ return DependencyProperty.UnsetValue;
+ }
+ }
+
+ public override object ProvideValue (IServiceProvider serviceProvider) => this;
+ }
+}
diff --git a/Xamarin.PropertyEditing.Windows/EditorPropertySelector.cs b/Xamarin.PropertyEditing.Windows/EditorPropertySelector.cs
index a2b4e6a..82eedbd 100644
--- a/Xamarin.PropertyEditing.Windows/EditorPropertySelector.cs
+++ b/Xamarin.PropertyEditing.Windows/EditorPropertySelector.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
+using Xamarin.PropertyEditing.Common;
using Xamarin.PropertyEditing.Drawing;
using Xamarin.PropertyEditing.ViewModels;
@@ -113,7 +114,11 @@ namespace Xamarin.PropertyEditing.Windows
{ typeof(TypePropertyViewModel), typeof(TypeEditorControl) },
{ typeof(CollectionPropertyViewModel), typeof(CollectionEditor) },
{ typeof(RatioViewModel), typeof(RatioEditorControl) },
- { typeof(AutoResizingPropertyViewModel), typeof(AutoResizingMaskEditorControl) }
+ { typeof(AutoResizingPropertyViewModel), typeof(AutoResizingMaskEditorControl) },
+ { typeof(PropertyViewModel<char>), typeof(StringEditorControl) },
+ { typeof(PropertyViewModel<FilePath>), typeof(StringEditorControl) },
+ { typeof(PropertyViewModel<Date>), typeof(DateEditorControl) },
+ { typeof(PropertyViewModel<Time>), typeof(TimeEditorControl) },
};
}
}
diff --git a/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml b/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml
index e50445c..ca483d9 100644
--- a/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml
+++ b/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml
@@ -49,6 +49,8 @@
<local:NegativeThicknessConverter x:Key="NegativeThicknessConverter" />
<local:GroupedEditorPropertySelector x:Key="GroupedEditorSelector" />
<local:MultiplierConverter x:Key="MultiplierConverter" />
+ <local:DateToTextConverter x:Key="DateToTextConverter" />
+ <local:TimeToTextConverter x:Key="TimeToTextConverter" />
<Style TargetType="local:CombinablePredefinedValuesEditor">
<Setter Property="Template">
@@ -301,6 +303,38 @@
</Setter>
</Style>
+ <Style TargetType="local:DateEditorControl">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="local:DateEditorControl">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+
+ <local:TextBoxEx x:Name="TextBox" Grid.Column="0" FocusSelectsAll="True" AutomationProperties.Name="{Binding Property.Name,Mode=OneTime}" Text="{Binding Value,UpdateSourceTrigger=Explicit,Converter={StaticResource DateToTextConverter}}" VerticalContentAlignment="Center" IsEnabled="{Binding IsInputEnabled}" />
+ </Grid>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Style TargetType="local:TimeEditorControl">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="local:TimeEditorControl">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+
+ <local:TextBoxEx x:Name="TextBox" Grid.Column="0" FocusSelectsAll="True" AutomationProperties.Name="{Binding Property.Name,Mode=OneTime}" Text="{Binding Value,UpdateSourceTrigger=Explicit,Converter={StaticResource TimeToTextConverter}}" VerticalContentAlignment="Center" IsEnabled="{Binding IsInputEnabled}" />
+ </Grid>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
<Style TargetType="local:BoolEditorControl">
<Setter Property="Template">
<Setter.Value>
diff --git a/Xamarin.PropertyEditing.Windows/TimeEditorControl.cs b/Xamarin.PropertyEditing.Windows/TimeEditorControl.cs
new file mode 100644
index 0000000..9fd1e3d
--- /dev/null
+++ b/Xamarin.PropertyEditing.Windows/TimeEditorControl.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.PropertyEditing.Windows
+{
+ class TimeEditorControl : PropertyEditorControl
+ {
+ }
+}
diff --git a/Xamarin.PropertyEditing.Windows/TimeToTextConverter.cs b/Xamarin.PropertyEditing.Windows/TimeToTextConverter.cs
new file mode 100644
index 0000000..d736141
--- /dev/null
+++ b/Xamarin.PropertyEditing.Windows/TimeToTextConverter.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+using Xamarin.PropertyEditing.Common;
+
+namespace Xamarin.PropertyEditing.Windows
+{
+ [ValueConversion (typeof (Time), typeof (string))]
+ internal class TimeToTextConverter : MarkupExtension, IValueConverter
+ {
+ public object Convert (object value, Type targetType, object parameter, CultureInfo culture)
+ => !(value is Time timeValue) ? DependencyProperty.UnsetValue
+ : timeValue.ToString ();
+
+ public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value is string dateValue) {
+ var parsedValue = Time.Parse (dateValue);
+ if (parsedValue != null)
+ return parsedValue;
+ else
+ return value;
+ } else {
+ return DependencyProperty.UnsetValue;
+ }
+ }
+
+ public override object ProvideValue (IServiceProvider serviceProvider) => this;
+ }
+}
diff --git a/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj b/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj
index fd84130..42f3aba 100644
--- a/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj
+++ b/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj
@@ -1,223 +1,227 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{60AF04BE-1B6B-411B-BCBA-C95EAFBD7AC0}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Xamarin.PropertyEditing.Windows</RootNamespace>
- <AssemblyName>Xamarin.PropertyEditing.Windows</AssemblyName>
- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <TargetFrameworkProfile />
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="PresentationCore" />
- <Reference Include="PresentationFramework" />
- <Reference Include="PresentationFramework.Aero" />
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.Windows.Presentation" />
- <Reference Include="System.Xaml" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Net.Http" />
- <Reference Include="System.Xml" />
- <Reference Include="UIAutomationProvider" />
- <Reference Include="WindowsBase" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\Xamarin.PropertyEditing\Properties\GlobalAssemblyInfo.cs">
- <Link>Properties\GlobalAssemblyInfo.cs</Link>
- </Compile>
- <Compile Include="ArrangeModeLocalizedConverter.cs" />
- <Compile Include="AutoResizingMaskEditorControl.cs" />
- <Compile Include="BoolEditorControl.cs" />
- <Compile Include="BoolsToVisibilityConverter.cs" />
- <Compile Include="BrushBoxControl.cs" />
- <Compile Include="BrushChoiceTemplateSelector.cs" />
- <Compile Include="BrushEditorControl.cs" />
- <Compile Include="BrushTabbedEditorControl.cs" />
- <Compile Include="BrushToDarknessConverter.cs" />
- <Compile Include="ButtonEx.cs" />
- <Compile Include="ByteToDoubleConverter.cs" />
- <Compile Include="CategoryExpander.cs" />
- <Compile Include="CollectionEditor.cs" />
- <Compile Include="CollectionEditorWindow.xaml.cs">
- <DependentUpon>CollectionEditorWindow.xaml</DependentUpon>
- </Compile>
- <Compile Include="CombinablePredefinedValuesEditorControl.cs" />
- <Compile Include="ComboBoxEx.cs" />
- <Compile Include="CommonBrushToBrushConverter.cs" />
- <Compile Include="ByteToPercentageConverter.cs" />
- <Compile Include="ChoiceControl.cs" />
- <Compile Include="ColorComponentBox.cs" />
- <Compile Include="ColorComponentModel.cs" />
- <Compile Include="ColorComponentsEditorControl.cs" />
- <Compile Include="ColorComponentToBrushConverter.cs" />
- <Compile Include="ColorEditorControlBase.cs" />
- <Compile Include="ColorHelper.cs" />
- <Compile Include="CommonColorToColorConverter.cs" />
- <Compile Include="CreateBindingWindow.xaml.cs">
- <DependentUpon>CreateBindingWindow.xaml</DependentUpon>
- </Compile>
- <Compile Include="CreateResourceWindow.xaml.cs">
- <DependentUpon>CreateResourceWindow.xaml</DependentUpon>
- </Compile>
- <Compile Include="CreateVariantWindow.xaml.cs">
- <DependentUpon>CreateVariantWindow.xaml</DependentUpon>
- </Compile>
- <Compile Include="DoubleToAngleConverter.cs" />
- <Compile Include="CreateValueConverterWindow.xaml.cs">
- <DependentUpon>CreateValueConverterWindow.xaml</DependentUpon>
- </Compile>
- <Compile Include="EntryPopup.cs" />
- <Compile Include="CurrentColorEditorControl.cs" />
- <Compile Include="DoubleToPercentageConverter.cs" />
- <Compile Include="DoubleToQuantityConverter.cs" />
- <Compile Include="FilterExpander.cs" />
- <Compile Include="HasItemsToVisibilityConverter.cs" />
- <Compile Include="InvertedVisibilityConverter.cs" />
- <Compile Include="InvokePropertyButtonCommand.cs" />
- <Compile Include="IPropertiesHost.cs" />
- <Compile Include="MaterialDesignColorEditorControl.cs" />
- <Compile Include="MultiplierConverter.cs" />
- <Compile Include="MultiplyMarginConverter.cs" />
- <Compile Include="NegativeThicknessConverter.cs" />
- <Compile Include="NullVisibilityConverter.cs" />
- <Compile Include="ObjectEditorControl.cs" />
- <Compile Include="PreviewTemplateSelector.cs" />
- <Compile Include="ResourceBrushEditorControl.cs" />
- <Compile Include="ResourceSelectorWindow.xaml.cs">
- <DependentUpon>ResourceSelectorWindow.xaml</DependentUpon>
- </Compile>
- <Compile Include="Spinner.cs" />
- <Compile Include="TextBoxEx.cs" />
- <Compile Include="ToggleButtonEx.cs" />
- <Compile Include="EditorPropertySelector.cs" />
- <Compile Include="EnumEditorControl.cs" />
- <Compile Include="HexColorConverter.cs" />
- <Compile Include="HeaderedContextMenu.cs" />
- <Compile Include="GroupEditorControl.cs" />
- <Compile Include="HostEnvironment.cs" />
- <Compile Include="MenuButton.cs" />
- <Compile Include="NumericEditorControl.cs" />
- <Compile Include="NumericTemplateSelector.cs" />
- <Compile Include="NumericUpDownControl.cs" />
- <Compile Include="OppositeBoolConverter.cs" />
- <Compile Include="PointEditorControl.cs" />
- <Compile Include="PointHelper.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="PropertyButton.cs" />
- <Compile Include="PropertyEditorControl.cs" />
- <Compile Include="PropertyEditorPanel.cs" />
- <Compile Include="PropertyMenuItemContainerStyleSelector.cs" />
- <Compile Include="PropertyPresenter.cs" />
- <Compile Include="ShadeEditorControl.cs" />
- <Compile Include="RatioEditorControl.cs" />
- <Compile Include="SizeEditorControl.cs" />
- <Compile Include="HueEditorControl.cs" />
- <Compile Include="SolidBrushEditorControl.cs" />
- <Compile Include="ThicknessEditorControl.cs" />
- <Compile Include="StringEditorControl.cs" />
- <Compile Include="TreeViewItemEx.cs" />
- <Compile Include="TypeEditorControl.cs" />
- <Compile Include="TypeSelectorControl.xaml.cs">
- <DependentUpon>TypeSelectorControl.xaml</DependentUpon>
- </Compile>
- <Compile Include="TypeSelectorWindow.xaml.cs">
- <DependentUpon>TypeSelectorWindow.xaml</DependentUpon>
- </Compile>
- <Compile Include="WindowEx.cs" />
- <Compile Include="XamlHelper.cs" />
- </ItemGroup>
- <ItemGroup>
- <Page Include="CollectionEditorWindow.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="CreateBindingWindow.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="CreateResourceWindow.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="CreateValueConverterWindow.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="CreateVariantWindow.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="ResourceSelectorWindow.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="Themes\DialogResources.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="Themes\Resources.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="Themes\PropertyEditorPanelStyle.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="Themes\VS.Dark.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="Themes\VS.Light.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="TypeSelectorControl.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <Page Include="TypeSelectorWindow.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Xamarin.PropertyEditing\Xamarin.PropertyEditing.csproj">
- <Project>{A0B6FE73-D046-4E1C-BA9D-F20683889C5A}</Project>
- <Name>Xamarin.PropertyEditing</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Page Include="Themes\MenuButtonStyle.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-</Project>
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{60AF04BE-1B6B-411B-BCBA-C95EAFBD7AC0}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Xamarin.PropertyEditing.Windows</RootNamespace>
+ <AssemblyName>Xamarin.PropertyEditing.Windows</AssemblyName>
+ <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ <Reference Include="PresentationFramework.Aero" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Presentation" />
+ <Reference Include="System.Xaml" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ <Reference Include="UIAutomationProvider" />
+ <Reference Include="WindowsBase" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\Xamarin.PropertyEditing\Properties\GlobalAssemblyInfo.cs">
+ <Link>Properties\GlobalAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="ArrangeModeLocalizedConverter.cs" />
+ <Compile Include="AutoResizingMaskEditorControl.cs" />
+ <Compile Include="BoolEditorControl.cs" />
+ <Compile Include="BoolsToVisibilityConverter.cs" />
+ <Compile Include="BrushBoxControl.cs" />
+ <Compile Include="BrushChoiceTemplateSelector.cs" />
+ <Compile Include="BrushEditorControl.cs" />
+ <Compile Include="BrushTabbedEditorControl.cs" />
+ <Compile Include="BrushToDarknessConverter.cs" />
+ <Compile Include="ButtonEx.cs" />
+ <Compile Include="ByteToDoubleConverter.cs" />
+ <Compile Include="CategoryExpander.cs" />
+ <Compile Include="CollectionEditor.cs" />
+ <Compile Include="CollectionEditorWindow.xaml.cs">
+ <DependentUpon>CollectionEditorWindow.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="CombinablePredefinedValuesEditorControl.cs" />
+ <Compile Include="ComboBoxEx.cs" />
+ <Compile Include="CommonBrushToBrushConverter.cs" />
+ <Compile Include="ByteToPercentageConverter.cs" />
+ <Compile Include="ChoiceControl.cs" />
+ <Compile Include="ColorComponentBox.cs" />
+ <Compile Include="ColorComponentModel.cs" />
+ <Compile Include="ColorComponentsEditorControl.cs" />
+ <Compile Include="ColorComponentToBrushConverter.cs" />
+ <Compile Include="ColorEditorControlBase.cs" />
+ <Compile Include="ColorHelper.cs" />
+ <Compile Include="CommonColorToColorConverter.cs" />
+ <Compile Include="CreateBindingWindow.xaml.cs">
+ <DependentUpon>CreateBindingWindow.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="CreateResourceWindow.xaml.cs">
+ <DependentUpon>CreateResourceWindow.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="CreateVariantWindow.xaml.cs">
+ <DependentUpon>CreateVariantWindow.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="DateEditorControl.cs" />
+ <Compile Include="DateToTextConverter.cs" />
+ <Compile Include="DoubleToAngleConverter.cs" />
+ <Compile Include="CreateValueConverterWindow.xaml.cs">
+ <DependentUpon>CreateValueConverterWindow.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="EntryPopup.cs" />
+ <Compile Include="CurrentColorEditorControl.cs" />
+ <Compile Include="DoubleToPercentageConverter.cs" />
+ <Compile Include="DoubleToQuantityConverter.cs" />
+ <Compile Include="FilterExpander.cs" />
+ <Compile Include="HasItemsToVisibilityConverter.cs" />
+ <Compile Include="InvertedVisibilityConverter.cs" />
+ <Compile Include="InvokePropertyButtonCommand.cs" />
+ <Compile Include="IPropertiesHost.cs" />
+ <Compile Include="MaterialDesignColorEditorControl.cs" />
+ <Compile Include="MultiplierConverter.cs" />
+ <Compile Include="MultiplyMarginConverter.cs" />
+ <Compile Include="NegativeThicknessConverter.cs" />
+ <Compile Include="NullVisibilityConverter.cs" />
+ <Compile Include="ObjectEditorControl.cs" />
+ <Compile Include="PreviewTemplateSelector.cs" />
+ <Compile Include="ResourceBrushEditorControl.cs" />
+ <Compile Include="ResourceSelectorWindow.xaml.cs">
+ <DependentUpon>ResourceSelectorWindow.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Spinner.cs" />
+ <Compile Include="TextBoxEx.cs" />
+ <Compile Include="TimeEditorControl.cs" />
+ <Compile Include="TimeToTextConverter.cs" />
+ <Compile Include="ToggleButtonEx.cs" />
+ <Compile Include="EditorPropertySelector.cs" />
+ <Compile Include="EnumEditorControl.cs" />
+ <Compile Include="HexColorConverter.cs" />
+ <Compile Include="HeaderedContextMenu.cs" />
+ <Compile Include="GroupEditorControl.cs" />
+ <Compile Include="HostEnvironment.cs" />
+ <Compile Include="MenuButton.cs" />
+ <Compile Include="NumericEditorControl.cs" />
+ <Compile Include="NumericTemplateSelector.cs" />
+ <Compile Include="NumericUpDownControl.cs" />
+ <Compile Include="OppositeBoolConverter.cs" />
+ <Compile Include="PointEditorControl.cs" />
+ <Compile Include="PointHelper.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="PropertyButton.cs" />
+ <Compile Include="PropertyEditorControl.cs" />
+ <Compile Include="PropertyEditorPanel.cs" />
+ <Compile Include="PropertyMenuItemContainerStyleSelector.cs" />
+ <Compile Include="PropertyPresenter.cs" />
+ <Compile Include="ShadeEditorControl.cs" />
+ <Compile Include="RatioEditorControl.cs" />
+ <Compile Include="SizeEditorControl.cs" />
+ <Compile Include="HueEditorControl.cs" />
+ <Compile Include="SolidBrushEditorControl.cs" />
+ <Compile Include="ThicknessEditorControl.cs" />
+ <Compile Include="StringEditorControl.cs" />
+ <Compile Include="TreeViewItemEx.cs" />
+ <Compile Include="TypeEditorControl.cs" />
+ <Compile Include="TypeSelectorControl.xaml.cs">
+ <DependentUpon>TypeSelectorControl.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="TypeSelectorWindow.xaml.cs">
+ <DependentUpon>TypeSelectorWindow.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="WindowEx.cs" />
+ <Compile Include="XamlHelper.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Page Include="CollectionEditorWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="CreateBindingWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="CreateResourceWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="CreateValueConverterWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="CreateVariantWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="ResourceSelectorWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="Themes\DialogResources.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="Themes\Resources.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="Themes\PropertyEditorPanelStyle.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="Themes\VS.Dark.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="Themes\VS.Light.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="TypeSelectorControl.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="TypeSelectorWindow.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Xamarin.PropertyEditing\Xamarin.PropertyEditing.csproj">
+ <Project>{A0B6FE73-D046-4E1C-BA9D-F20683889C5A}</Project>
+ <Name>Xamarin.PropertyEditing</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Page Include="Themes\MenuButtonStyle.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Xamarin.PropertyEditing/Common/Date.cs b/Xamarin.PropertyEditing/Common/Date.cs
new file mode 100644
index 0000000..7332349
--- /dev/null
+++ b/Xamarin.PropertyEditing/Common/Date.cs
@@ -0,0 +1,60 @@
+using System;
+
+namespace Xamarin.PropertyEditing.Common
+{
+ public class Date : IEquatable<Date>
+ {
+ private readonly DateTime dateTime;
+
+ public Date (DateTime dateTime)
+ {
+ this.dateTime = dateTime;
+ }
+
+ public DateTime DateTime {
+ get{
+ return this.dateTime;
+ }
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj == null)
+ return false;
+ if ((obj is Date d))
+ return Equals (d);
+ else
+ return false;
+ }
+
+ public bool Equals (Date other)
+ {
+ if (other == null)
+ return false;
+ return this.dateTime.Equals (other);
+ }
+
+ public override int GetHashCode ()
+ {
+ var hashCode = 1861433795;
+ unchecked {
+ hashCode = hashCode * -1521134295 + this.dateTime.GetHashCode ();
+ }
+ return hashCode;
+ }
+
+ public override string ToString ()
+ {
+ return this.dateTime.ToShortDateString ();
+ }
+
+ public static Date Parse (string value)
+ {
+ try {
+ return new Date (DateTime.Parse (value));
+ } catch (Exception) {
+ return null;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.PropertyEditing/Common/Time.cs b/Xamarin.PropertyEditing/Common/Time.cs
new file mode 100644
index 0000000..9905c40
--- /dev/null
+++ b/Xamarin.PropertyEditing/Common/Time.cs
@@ -0,0 +1,59 @@
+using System;
+
+namespace Xamarin.PropertyEditing.Common
+{
+ public class Time : IEquatable<Time>
+ {
+ private readonly DateTime dateTime;
+
+ public DateTime DateTime {
+ get {
+ return this.dateTime;
+ }
+ }
+
+ public Time (DateTime dateTime)
+ {
+ this.dateTime = dateTime;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj == null)
+ return false;
+ if ((obj is Time d))
+ return Equals (d);
+ else
+ return false;
+ }
+
+ public bool Equals (Time other)
+ {
+ if (other == null)
+ return false;
+ return this.dateTime.Equals (other.DateTime);
+ }
+
+ public override int GetHashCode ()
+ {
+ var hashCode = 1861433795;
+ unchecked {
+ hashCode = hashCode * -1521134295 + this.dateTime.GetHashCode ();
+ }
+ return hashCode;
+ }
+ public override string ToString ()
+ {
+ return this.dateTime.ToLongTimeString ();
+ }
+
+ public static Time Parse(string value)
+ {
+ try {
+ return new Time (DateTime.Parse (value));
+ } catch (Exception) {
+ return null;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs b/Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs
index 5862ad9..8df2740 100644
--- a/Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs
+++ b/Xamarin.PropertyEditing/ViewModels/PropertiesViewModel.cs
@@ -656,6 +656,8 @@ namespace Xamarin.PropertyEditing.ViewModels
{ typeof(ITypeInfo), (tp,p,e,v) => new TypePropertyViewModel (tp, p, e, v) },
{ typeof(CommonRatio), (tp, p, e, v) => new RatioViewModel (tp, p, e, v) },
{ typeof(AutoResizingFlags), (tp, p, e, v) => new AutoResizingPropertyViewModel (tp, p, e, v) },
+ { typeof(Date), (tp, p, e, v) => new PropertyViewModel<Date> (tp, p, e, v) },
+ { typeof(Time), (tp, p, e, v) => new PropertyViewModel<Time> (tp, p, e, v) },
};
}
}