MobileTimeButton.xaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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"/>
  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. Clicked="_frame_OnClicked">
  19. <local:MobileCard.Triggers>
  20. <DataTrigger TargetType="local:MobileCard" Binding="{TemplateBinding IsEnabled}" Value="False">
  21. <Setter Property="BackgroundColor" Value="Silver" />
  22. </DataTrigger>
  23. <DataTrigger TargetType="local:MobileCard" Binding="{TemplateBinding IsEnabled}" Value="False">
  24. <Setter Property="BorderColor" Value="Gray" />
  25. </DataTrigger>
  26. </local:MobileCard.Triggers>
  27. <material:MaterialLabel
  28. x:Name="_label"
  29. Text="{TemplateBinding Time, Converter={StaticResource TimeSpanFormatter}}"
  30. VerticalOptions="CenterAndExpand"
  31. HorizontalOptions="CenterAndExpand"
  32. TypeScale = "{TemplateBinding TypeScale}"
  33. HorizontalTextAlignment = "Center"
  34. TextColor="{TemplateBinding TextColor}"
  35. />
  36. </local:MobileCard>
  37. </ControlTemplate>
  38. </ContentView.ControlTemplate>
  39. </ContentView>