summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-04-19 01:01:58 -0600
committerJason Smith <jason.smith@xamarin.com>2016-04-19 00:01:58 -0700
commita98f3fb2aae3c5b6a3fa5140e51f51ec67843a49 (patch)
tree654fa47cbd3cc889061466939630dcd5133cc837 /Xamarin.Forms.Core
parent89a50d4bc1f4aaf83d5f92a28c2a7a96282cc0d3 (diff)
downloadxamarin-forms-a98f3fb2aae3c5b6a3fa5140e51f51ec67843a49.tar.gz
xamarin-forms-a98f3fb2aae3c5b6a3fa5140e51f51ec67843a49.tar.bz2
xamarin-forms-a98f3fb2aae3c5b6a3fa5140e51f51ec67843a49.zip
Add TextColor Property to Picker, TimePicker, DatePicker (#84)
* Add TextColor property to TimePicker Add TextColor page to TimePicker gallery Add TimePicker color toggling to color toggle test page Split color toggle tests up among tabs * Implement TimePicker.TextColor in iOS * Implement TimePicker.TextColor for WinRT tablet * Add IsEnabled=false tests to DefaultColorToggleTest Button and TimePicker Consolidate ColorStates array Fix IsEnabled changing color bug on iOS * Implement TimePicker.TextColor for WP8 * Add TextColor property to DatePicker Add DatePicker section to DefaultColorToggleTest Impement DatePicker.TextColor for WP8 * Implement DatePicker.TextColor for WinRT/UWP/Windows Phone 8.1 * Implement DatePicker.TextColor for iOS * Add TextColor to DatePicker Gallery Page * Implement DatePicker.TextColor for Android * Add Picker Gallery page for TextColor Implement Picker.TextColor on Android Consolidate TextColor management for Button, Picker, DatePicker, TimePicker Implement * Add untracked TextColorSwitcher Implement Picker.TextColor in iOS * Implement Picker.TextColor in WinRT/UWP/Windows Phone 8.1 Remove Pioker Loaded handlers in Dispose * Implement Picker.TextColor in WP8 * Removed unused field Update ignored warnings * Update docs * Use nameof() for BindableProperties * Cleanup * Fix custom renderer crashes for classes using TextColorSwitcher * Correct property name references * Fix typo and 'if' formatting * Add missing else
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/DatePicker.cs16
-rw-r--r--Xamarin.Forms.Core/Picker.cs12
-rw-r--r--Xamarin.Forms.Core/TimePicker.cs12
3 files changed, 32 insertions, 8 deletions
diff --git a/Xamarin.Forms.Core/DatePicker.cs b/Xamarin.Forms.Core/DatePicker.cs
index 15f1c198..20eecae4 100644
--- a/Xamarin.Forms.Core/DatePicker.cs
+++ b/Xamarin.Forms.Core/DatePicker.cs
@@ -6,17 +6,19 @@ namespace Xamarin.Forms
[RenderWith(typeof(_DatePickerRenderer))]
public class DatePicker : View
{
- public static readonly BindableProperty FormatProperty = BindableProperty.Create("Format", typeof(string), typeof(DatePicker), "d");
+ public static readonly BindableProperty FormatProperty = BindableProperty.Create(nameof(Format), typeof(string), typeof(DatePicker), "d");
- public static readonly BindableProperty DateProperty = BindableProperty.Create("Date", typeof(DateTime), typeof(DatePicker), DateTime.Today, BindingMode.TwoWay, coerceValue: CoerceDate,
+ public static readonly BindableProperty DateProperty = BindableProperty.Create(nameof(Date), typeof(DateTime), typeof(DatePicker), DateTime.Today, BindingMode.TwoWay, coerceValue: CoerceDate,
propertyChanged: DatePropertyChanged);
- public static readonly BindableProperty MinimumDateProperty = BindableProperty.Create("MinimumDate", typeof(DateTime), typeof(DatePicker), new DateTime(1900, 1, 1),
+ public static readonly BindableProperty MinimumDateProperty = BindableProperty.Create(nameof(MinimumDate), typeof(DateTime), typeof(DatePicker), new DateTime(1900, 1, 1),
validateValue: ValidateMinimumDate, coerceValue: CoerceMinimumDate);
- public static readonly BindableProperty MaximumDateProperty = BindableProperty.Create("MaximumDate", typeof(DateTime), typeof(DatePicker), new DateTime(2100, 12, 31),
+ public static readonly BindableProperty MaximumDateProperty = BindableProperty.Create(nameof(MaximumDate), typeof(DateTime), typeof(DatePicker), new DateTime(2100, 12, 31),
validateValue: ValidateMaximumDate, coerceValue: CoerceMaximumDate);
+ public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(DatePicker), Color.Default);
+
public DateTime Date
{
get { return (DateTime)GetValue(DateProperty); }
@@ -41,6 +43,12 @@ namespace Xamarin.Forms
set { SetValue(MinimumDateProperty, value); }
}
+ public Color TextColor
+ {
+ get { return (Color)GetValue(TextColorProperty); }
+ set { SetValue(TextColorProperty, value); }
+ }
+
public event EventHandler<DateChangedEventArgs> DateSelected;
static object CoerceDate(BindableObject bindable, object value)
diff --git a/Xamarin.Forms.Core/Picker.cs b/Xamarin.Forms.Core/Picker.cs
index 733f2079..5c2fb72b 100644
--- a/Xamarin.Forms.Core/Picker.cs
+++ b/Xamarin.Forms.Core/Picker.cs
@@ -8,9 +8,11 @@ namespace Xamarin.Forms
[RenderWith(typeof(_PickerRenderer))]
public class Picker : View
{
- public static readonly BindableProperty TitleProperty = BindableProperty.Create("Title", typeof(string), typeof(Picker), default(string));
+ public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(Picker), Color.Default);
- public static readonly BindableProperty SelectedIndexProperty = BindableProperty.Create("SelectedIndex", typeof(int), typeof(Picker), -1, BindingMode.TwoWay,
+ public static readonly BindableProperty TitleProperty = BindableProperty.Create(nameof(Title), typeof(string), typeof(Picker), default(string));
+
+ public static readonly BindableProperty SelectedIndexProperty = BindableProperty.Create(nameof(SelectedIndex), typeof(int), typeof(Picker), -1, BindingMode.TwoWay,
propertyChanged: (bindable, oldvalue, newvalue) =>
{
EventHandler eh = ((Picker)bindable).SelectedIndexChanged;
@@ -32,6 +34,12 @@ namespace Xamarin.Forms
set { SetValue(SelectedIndexProperty, value); }
}
+ public Color TextColor
+ {
+ get { return (Color)GetValue(TextColorProperty); }
+ set { SetValue(TextColorProperty, value); }
+ }
+
public string Title
{
get { return (string)GetValue(TitleProperty); }
diff --git a/Xamarin.Forms.Core/TimePicker.cs b/Xamarin.Forms.Core/TimePicker.cs
index a9cf2e19..0a33c2e3 100644
--- a/Xamarin.Forms.Core/TimePicker.cs
+++ b/Xamarin.Forms.Core/TimePicker.cs
@@ -6,9 +6,11 @@ namespace Xamarin.Forms
[RenderWith(typeof(_TimePickerRenderer))]
public class TimePicker : View
{
- public static readonly BindableProperty FormatProperty = BindableProperty.Create("Format", typeof(string), typeof(TimePicker), "t");
+ public static readonly BindableProperty FormatProperty = BindableProperty.Create(nameof(Format), typeof(string), typeof(TimePicker), "t");
- public static readonly BindableProperty TimeProperty = BindableProperty.Create("Time", typeof(TimeSpan), typeof(TimePicker), new TimeSpan(0), BindingMode.TwoWay, (bindable, value) =>
+ public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(TimePicker), Color.Default);
+
+ public static readonly BindableProperty TimeProperty = BindableProperty.Create(nameof(Time), typeof(TimeSpan), typeof(TimePicker), new TimeSpan(0), BindingMode.TwoWay, (bindable, value) =>
{
var time = (TimeSpan)value;
return time.TotalHours < 24 && time.TotalMilliseconds >= 0;
@@ -20,6 +22,12 @@ namespace Xamarin.Forms
set { SetValue(FormatProperty, value); }
}
+ public Color TextColor
+ {
+ get { return (Color)GetValue(TextColorProperty); }
+ set { SetValue(TextColorProperty, value); }
+ }
+
public TimeSpan Time
{
get { return (TimeSpan)GetValue(TimeProperty); }