ToolGrid.xaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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:local="clr-namespace:comal.timesheets"
  5. x:Class="comal.timesheets.ToolGrid">
  6. <ContentView.Resources>
  7. <local:StringToBooleanConverter x:Key="StringToBooleanConverter"/>
  8. <!-- <local:BooleanToColorConverter x:Key="BackgroundColorConverter" DefaultColor="Silver"/> -->
  9. <!-- <local:BooleanToColorConverter x:Key="ForegroundColorConverter" DefaultColor="Gray"/> -->
  10. </ContentView.Resources>
  11. <ContentView.BindingContext>
  12. <local:ToolGridViewModel x:Name="_viewModel"/>
  13. </ContentView.BindingContext>
  14. <ContentView.Content>
  15. <ScrollView>
  16. <FlexLayout
  17. x:Name="_flexgrid"
  18. BindableLayout.ItemsSource = "{Binding Items}"
  19. HorizontalOptions="FillAndExpand"
  20. VerticalOptions="StartAndExpand"
  21. Wrap="Wrap"
  22. Direction="Row"
  23. JustifyContent="SpaceEvenly"
  24. AlignItems="Start"
  25. AlignContent="Start">
  26. <BindableLayout.ItemTemplate>
  27. <DataTemplate>
  28. <Grid
  29. MinimumWidthRequest="80"
  30. MinimumHeightRequest="104">
  31. <Grid.ColumnDefinitions>
  32. <ColumnDefinition Width="40"/>
  33. <ColumnDefinition Width="40"/>
  34. </Grid.ColumnDefinitions>
  35. <Grid.RowDefinitions>
  36. <RowDefinition Height="40"/>
  37. <RowDefinition Height="40"/>
  38. <RowDefinition Height="24"/>
  39. </Grid.RowDefinitions>
  40. <Frame
  41. CornerRadius="5"
  42. HasShadow="False"
  43. Margin="0"
  44. x:Name="toolFrame"
  45. Grid.Row="0"
  46. Grid.Column="0"
  47. Grid.RowSpan="2"
  48. Grid.ColumnSpan="2"
  49. MinimumWidthRequest="80"
  50. MinimumHeightRequest="104"
  51. BackgroundColor="{Binding BackgroundColor}">
  52. <Frame.Triggers>
  53. <!-- <DataTrigger TargetType="material:MaterialCard" Binding="{TemplateBinding IsEnabled}" Value="True"> -->
  54. <!-- <Setter Property="BackgroundColor" Value="{TemplateBinding ButtonColor}" /> -->
  55. <!-- </DataTrigger> -->
  56. <DataTrigger TargetType="Frame" Binding="{Binding IsEnabled}" Value="False">
  57. <Setter Property="BackgroundColor" Value="Silver" />
  58. </DataTrigger>
  59. </Frame.Triggers>
  60. <Frame.Padding>
  61. <OnPlatform x:TypeArguments="Thickness">
  62. <On Platform="Android" Value="15"/>
  63. <On Platform="iOS" Value="0"/>
  64. </OnPlatform>
  65. </Frame.Padding>
  66. <Image x:Name="toolEntryImage"
  67. Source="{Binding Image}">
  68. <Image.GestureRecognizers>
  69. <TapGestureRecognizer Tapped="ImageTapped" />
  70. </Image.GestureRecognizers>
  71. </Image>
  72. </Frame>
  73. <Frame
  74. x:Name="indicatorFrame"
  75. Grid.Row="0"
  76. Grid.Column="1"
  77. HorizontalOptions="End"
  78. HasShadow="False"
  79. VerticalOptions="Start"
  80. HeightRequest="30"
  81. WidthRequest="30"
  82. CornerRadius="15"
  83. IsVisible="{Binding Indicator, Converter={StaticResource StringToBooleanConverter}}"
  84. BackgroundColor="Yellow"
  85. Padding="1">
  86. <Label
  87. FontAttributes="Bold"
  88. TextColor="Red"
  89. FontSize="Medium"
  90. HorizontalOptions="Center"
  91. VerticalOptions="Center"
  92. Margin="1"
  93. Text="{Binding Indicator}"/>
  94. </Frame>
  95. <Label
  96. Grid.Row="2"
  97. Grid.Column="0"
  98. Grid.ColumnSpan="2"
  99. Text="{Binding Text}"
  100. FontSize="Micro"
  101. HorizontalTextAlignment="Center"
  102. VerticalTextAlignment="Start"
  103. Margin="0,-2,0,0"
  104. TextColor="{Binding TextColor}">
  105. <Label.Triggers>
  106. <DataTrigger TargetType="Label" Binding="{Binding IsEnabled}" Value="False">
  107. <Setter Property="TextColor" Value="Gray" />
  108. </DataTrigger>
  109. </Label.Triggers>
  110. </Label>
  111. </Grid>
  112. </DataTemplate>
  113. </BindableLayout.ItemTemplate>
  114. </FlexLayout>
  115. </ScrollView>
  116. </ContentView.Content>
  117. </ContentView>