MobileTimeButton.xaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <ContentView xmlns="http://xamarin.com/schemas/2014/forms"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
  4. xmlns:material="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"
  5. xmlns:local="clr-namespace:InABox.Mobile"
  6. x:Class="InABox.Mobile.MobileTimeButton">
  7. <ContentView.Resources>
  8. <local:TimeSpanFormatter x:Key="TimeSpanFormatter" x:Name="_timespanFormatter" Prompt="Select Time"/>
  9. </ContentView.Resources>
  10. <ContentView.ControlTemplate>
  11. <ControlTemplate>
  12. <local:MobileCard
  13. x:Name="_frame"
  14. Padding = "{TemplateBinding Padding}"
  15. IsEnabled="True"
  16. BackgroundColor="{TemplateBinding ButtonColor}"
  17. BorderColor="{TemplateBinding BorderColor}"
  18. IsClickable="True"
  19. Clicked="_frame_OnClicked">
  20. <local:MobileCard.Triggers>
  21. <DataTrigger TargetType="local:MobileCard" Binding="{TemplateBinding IsEnabled}" Value="False">
  22. <Setter Property="BackgroundColor" Value="Silver" />
  23. </DataTrigger>
  24. <DataTrigger TargetType="local:MobileCard" Binding="{TemplateBinding IsEnabled}" Value="False">
  25. <Setter Property="BorderColor" Value="Gray" />
  26. </DataTrigger>
  27. </local:MobileCard.Triggers>
  28. <material:MaterialLabel
  29. x:Name="_label"
  30. Text="{TemplateBinding Time, Converter={StaticResource TimeSpanFormatter}}"
  31. VerticalOptions="CenterAndExpand"
  32. HorizontalOptions="CenterAndExpand"
  33. TypeScale = "{TemplateBinding TypeScale}"
  34. HorizontalTextAlignment = "Center"
  35. TextColor="{TemplateBinding TextColor}"
  36. />
  37. </local:MobileCard>
  38. </ControlTemplate>
  39. </ContentView.ControlTemplate>
  40. </ContentView>