MobileModuleList.xaml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <ContentView
  3. xmlns="http://xamarin.com/schemas/2014/forms"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
  5. xmlns:mobile="clr-namespace:InABox.Mobile;assembly=InABox.Mobile.Shared"
  6. x:Class="InABox.Mobile.MobileModuleList" >
  7. <!-- <ContentView.Resources> -->
  8. <!-- <mobile:BooleanToColorConverter x:Key="BooleanToColorConverter" TrueColor="LightSalmon" FalseColor="LightGoldenrodYellow"/> -->
  9. <!-- </ContentView.Resources> -->
  10. <ContentView.Content>
  11. <mobile:MobileCollectionView
  12. x:Name="Modules"
  13. BackgroundColor="Transparent"
  14. PullToRefresh="False"
  15. ShowRecordCount="False">
  16. <mobile:MobileCollectionView.ItemTemplate>
  17. <DataTemplate x:DataType="mobile:MobileModuleItem">
  18. <mobile:MobileCard
  19. HorizontalOptions="FillAndExpand"
  20. BorderColor="{Binding BorderColor}"
  21. Margin="0,0,0,5"
  22. Padding="5"
  23. HeightRequest="70"
  24. IsClickable="True"
  25. Clicked="Module_Clicked"
  26. IsEnabled="{Binding IsEnabled}">
  27. <!-- BackgroundColor="{Binding AlertVisible, Converter={StaticResource BooleanToColorConverter}}" -->
  28. <mobile:MobileCard.Triggers>
  29. <DataTrigger TargetType="mobile:MobileCard" Binding="{Binding IsEnabled}" Value="False">
  30. <Setter Property="BackgroundColor" Value="Silver" />
  31. </DataTrigger>
  32. <DataTrigger TargetType="mobile:MobileCard" Binding="{Binding IsEnabled}" Value="False">
  33. <Setter Property="BorderColor" Value="Gray" />
  34. </DataTrigger>
  35. <DataTrigger TargetType="mobile:MobileCard" Binding="{Binding AlertVisible}" Value="False">
  36. <Setter Property="BackgroundColor" Value="LightGoldenrodYellow" />
  37. </DataTrigger>
  38. <DataTrigger TargetType="mobile:MobileCard" Binding="{Binding AlertVisible}" Value="True">
  39. <Setter Property="BackgroundColor" Value="LightSalmon" />
  40. </DataTrigger>
  41. </mobile:MobileCard.Triggers>
  42. <Grid RowSpacing="0">
  43. <Grid.ColumnDefinitions>
  44. <ColumnDefinition Width="Auto"/>
  45. <ColumnDefinition Width="*"/>
  46. </Grid.ColumnDefinitions>
  47. <Grid.RowDefinitions>
  48. <RowDefinition Height="0.8*"/>
  49. <RowDefinition Height="1.2*"/>
  50. </Grid.RowDefinitions>
  51. <Image
  52. Source="{Binding Thumbnail}"
  53. Grid.Row="0"
  54. Grid.Column="0"
  55. Grid.RowSpan="2"
  56. Margin="10"/>
  57. <Label
  58. Text="{Binding Header}"
  59. Grid.Row="0"
  60. Grid.Column="1"
  61. HorizontalTextAlignment="Start"
  62. VerticalTextAlignment="End"
  63. FontSize="Medium"
  64. FontAttributes="Bold"
  65. TextColor="{Binding TextColor}">
  66. <Label.Triggers>
  67. <DataTrigger TargetType="Label" Binding="{Binding IsEnabled}" Value="False">
  68. <Setter Property="TextColor" Value="Gray" />
  69. </DataTrigger>
  70. </Label.Triggers>
  71. </Label>
  72. <Label
  73. Text="{Binding Description}"
  74. Grid.Row="1"
  75. Grid.Column="1"
  76. HorizontalTextAlignment="Start"
  77. VerticalTextAlignment="Center"
  78. FontSize="Small"
  79. LineBreakMode="WordWrap"
  80. TextColor="{Binding TextColor}">
  81. <Label.Triggers>
  82. <DataTrigger TargetType="Label" Binding="{Binding IsEnabled}" Value="False">
  83. <Setter Property="TextColor" Value="Gray" />
  84. </DataTrigger>
  85. </Label.Triggers>
  86. </Label>
  87. <Frame
  88. x:Name="indicatorFrame"
  89. Grid.Row="0"
  90. Grid.Column="1"
  91. HasShadow="False"
  92. VerticalOptions="Start"
  93. HorizontalOptions="End"
  94. CornerRadius="12.5"
  95. IsVisible="{Binding AlertVisible}"
  96. BackgroundColor="Yellow"
  97. BorderColor="{Binding BorderColor}"
  98. Padding="0"
  99. Margin="0"
  100. HeightRequest="25"
  101. WidthRequest="25">
  102. <Label
  103. FontAttributes="Bold"
  104. TextColor="Red"
  105. FontSize="Micro"
  106. HorizontalTextAlignment="Center"
  107. VerticalTextAlignment="Center"
  108. Text="{Binding Alert}"
  109. WidthRequest="{Binding Source={RelativeSource Self}, Path=Height}"/>
  110. </Frame>
  111. </Grid>
  112. </mobile:MobileCard>
  113. </DataTemplate>
  114. </mobile:MobileCollectionView.ItemTemplate>
  115. </mobile:MobileCollectionView>
  116. </ContentView.Content>
  117. </ContentView>