MobileDateButton.xaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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.MobileDateButton">
  7. <ContentView.Resources>
  8. <local:DateTimeFormatter
  9. x:Key="DateTimeFormatter"
  10. x:Name="_datetimeformatter" />
  11. </ContentView.Resources>
  12. <ContentView.ControlTemplate>
  13. <ControlTemplate>
  14. <local:MobileCard
  15. x:Name="_frame"
  16. Padding = "{TemplateBinding Padding}"
  17. IsEnabled="True"
  18. BackgroundColor="{TemplateBinding ButtonColor}"
  19. BorderColor="{TemplateBinding BorderColor}"
  20. IsClickable="True"
  21. Clicked="_frame_OnClicked">
  22. <local:MobileCard.Triggers>
  23. <DataTrigger TargetType="local:MobileCard" Binding="{TemplateBinding IsEnabled}" Value="False">
  24. <Setter Property="BackgroundColor" Value="Silver" />
  25. </DataTrigger>
  26. <DataTrigger TargetType="local:MobileCard" Binding="{TemplateBinding IsEnabled}" Value="False">
  27. <Setter Property="BorderColor" Value="Gray" />
  28. </DataTrigger>
  29. </local:MobileCard.Triggers>
  30. <material:MaterialLabel
  31. x:Name="_label"
  32. Text="{TemplateBinding Date, Converter={StaticResource DateTimeFormatter}, Mode=TwoWay}"
  33. VerticalOptions="CenterAndExpand"
  34. HorizontalOptions="CenterAndExpand"
  35. TypeScale = "{TemplateBinding TypeScale}"
  36. HorizontalTextAlignment = "Center"
  37. TextColor="{TemplateBinding TextColor}"
  38. />
  39. </local:MobileCard>
  40. </ControlTemplate>
  41. </ContentView.ControlTemplate>
  42. </ContentView>