Skip to content

Commit

Permalink
Added a Open() method to use for our consumers, renamed x:names
Browse files Browse the repository at this point in the history
  • Loading branch information
haavamoa committed Jan 9, 2020
1 parent 784a7f0 commit 7c2605d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/DIPS.Xamarin.UI/Controls/DatePicker/DatePicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,13 @@ private static void OnDateChanged(BindableObject bindable, object oldvalue, obje
if (!(formattedObject is string formattedDate)) return;
datePicker.DateLabel.Text = formattedDate;
}

/// <summary>
/// Opens the date picker
/// </summary>
public void Open()
{
FormsDatePicker.Focus();
}
}
}
4 changes: 2 additions & 2 deletions src/DIPS.Xamarin.UI/Controls/TimePicker/TimePicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
x:Class="DIPS.Xamarin.UI.Controls.TimePicker.TimePicker"
x:Name="codeBehind">
<Grid IsClippedToBounds="True">
<TimePicker x:Name="FormsDatePicker"
<TimePicker x:Name="FormsTimePicker"
Time="{Binding Source={x:Reference codeBehind}, Path=Time}"
Margin="{Binding Source={x:Reference DateLabel}, Path=Height, Converter={ValueConverters:MultiplicationConverter Factor=-1}}"
TextColor="Transparent"
HeightRequest="{Binding Source={x:Reference DateLabel}, Path=Height}"
WidthRequest="{Binding Source={x:Reference DateLabel}, Path=Width}" />
<Label x:Name="DateLabel"
<Label x:Name="TimeLabel"
Text="{Binding Source={x:Reference codeBehind}, Path=Time}"
TextColor="{Binding Source={x:Reference codeBehind}, Path=LabelColor}"
InputTransparent="True"
Expand Down
9 changes: 7 additions & 2 deletions src/DIPS.Xamarin.UI/Controls/TimePicker/TimePicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public partial class TimePicker : ContentView
private static void OnLabelSizePropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
{
if (!(bindable is TimePicker timePicker)) return;
timePicker.DateLabel.FontSize = (double)newvalue;
timePicker.TimeLabel.FontSize = (double)newvalue;
}

/// <inheritdoc />
Expand Down Expand Up @@ -104,7 +104,12 @@ private static void TimePropertyChanged(BindableObject bindable, object oldvalue
var formattedObject = new TimeConverter() { Format = timePicker.Format }.Convert(timePicker.Time, null, null, CultureInfo.CurrentCulture);
if (!(formattedObject is string formattedDate))
return;
timePicker.DateLabel.Text = formattedDate;
timePicker.TimeLabel.Text = formattedDate;
}

public void Open()
{
FormsTimePicker.Focus();
}
}
}

0 comments on commit 7c2605d

Please sign in to comment.