MobileModuleList.xaml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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:MobileList
  12. x:Name="Modules"
  13. BackgroundColor="Transparent"
  14. PullToRefresh="False"
  15. ShowRecordCount="False">
  16. <mobile:MobileList.ItemTemplate>
  17. <DataTemplate x:DataType="mobile:MobileModuleItem">
  18. <mobile:MobileCard
  19. HorizontalOptions="FillAndExpand"
  20. BorderColor="{Binding BorderColor}"
  21. Margin="0,0,0,5"
  22. BackgroundColor="{Binding AlertVisible, Converter={StaticResource BooleanToColorConverter}}"
  23. Padding="5"
  24. HeightRequest="70"
  25. Clicked="Module_Clicked"
  26. IsEnabled="{Binding IsEnabled}">
  27. <mobile:MobileCard.Triggers>
  28. <DataTrigger TargetType="mobile:MobileCard" Binding="{Binding IsEnabled}" Value="False">
  29. <Setter Property="BackgroundColor" Value="Silver" />
  30. </DataTrigger>
  31. <DataTrigger TargetType="mobile:MobileCard" Binding="{Binding IsEnabled}" Value="False">
  32. <Setter Property="BorderColor" Value="Gray" />
  33. </DataTrigger>
  34. </mobile:MobileCard.Triggers>
  35. <Grid RowSpacing="0">
  36. <Grid.ColumnDefinitions>
  37. <ColumnDefinition Width="Auto"/>
  38. <ColumnDefinition Width="*"/>
  39. </Grid.ColumnDefinitions>
  40. <Grid.RowDefinitions>
  41. <RowDefinition Height="0.8*"/>
  42. <RowDefinition Height="1.2*"/>
  43. </Grid.RowDefinitions>
  44. <Image
  45. Source="{Binding Thumbnail}"
  46. Grid.Row="0"
  47. Grid.Column="0"
  48. Grid.RowSpan="2"
  49. Margin="10"/>
  50. <Label
  51. Text="{Binding Header}"
  52. Grid.Row="0"
  53. Grid.Column="1"
  54. HorizontalTextAlignment="Start"
  55. VerticalTextAlignment="End"
  56. FontSize="Medium"
  57. FontAttributes="Bold"
  58. TextColor="{Binding TextColor}">
  59. <Label.Triggers>
  60. <DataTrigger TargetType="Label" Binding="{Binding IsEnabled}" Value="False">
  61. <Setter Property="TextColor" Value="Gray" />
  62. </DataTrigger>
  63. </Label.Triggers>
  64. </Label>
  65. <Label
  66. Text="{Binding Description}"
  67. Grid.Row="1"
  68. Grid.Column="1"
  69. HorizontalTextAlignment="Start"
  70. VerticalTextAlignment="Center"
  71. FontSize="Small"
  72. LineBreakMode="WordWrap"
  73. TextColor="{Binding TextColor}">
  74. <Label.Triggers>
  75. <DataTrigger TargetType="Label" Binding="{Binding IsEnabled}" Value="False">
  76. <Setter Property="TextColor" Value="Gray" />
  77. </DataTrigger>
  78. </Label.Triggers>
  79. </Label>
  80. <Frame
  81. x:Name="indicatorFrame"
  82. Grid.Row="0"
  83. Grid.Column="1"
  84. HasShadow="False"
  85. VerticalOptions="Start"
  86. HorizontalOptions="End"
  87. CornerRadius="12.5"
  88. IsVisible="{Binding AlertVisible}"
  89. BackgroundColor="Yellow"
  90. BorderColor="{Binding BorderColor}"
  91. Padding="0"
  92. Margin="0"
  93. HeightRequest="25"
  94. WidthRequest="25">
  95. <Label
  96. FontAttributes="Bold"
  97. TextColor="Red"
  98. FontSize="Micro"
  99. HorizontalTextAlignment="Center"
  100. VerticalTextAlignment="Center"
  101. Text="{Binding Alert}"
  102. WidthRequest="{Binding Source={RelativeSource Self}, Path=Height}"/>
  103. </Frame>
  104. </Grid>
  105. </mobile:MobileCard>
  106. </DataTemplate>
  107. </mobile:MobileList.ItemTemplate>
  108. </mobile:MobileList>
  109. </ContentView.Content>
  110. </ContentView>