123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <?xml version="1.0" encoding="utf-8"?>
- <ContentView xmlns="http://xamarin.com/schemas/2014/forms"
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
- xmlns:local="clr-namespace:InABox.Mobile"
- x:Class="InABox.Mobile.MobileToolGrid">
-
- <ContentView.Resources>
- <local:BooleanToColorConverter x:Key="BooleanToColorConverter" TrueColor="LightSalmon" FalseColor="LightGoldenrodYellow"/>
- </ContentView.Resources>
-
- <ContentView.Content>
-
- <ScrollView>
-
- <Grid RowSpacing="5" ColumnSpacing="5"
- x:Name="_flexgrid"
- BindableLayout.ItemsSource = "{Binding VisibleItems}"
- HorizontalOptions="Fill"
- VerticalOptions="StartAndExpand"
- >
-
- <BindableLayout.ItemTemplate>
-
- <DataTemplate x:DataType="local:MobileToolItem">
-
- <Grid
- Margin="0"
- Grid.Row="{Binding Row}"
- Grid.Column="{Binding Column}"
- IsVisible="True"
- VerticalOptions="Fill"
- HorizontalOptions="Fill">
-
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
-
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <!-- <RowDefinition Height="15"/> -->
- </Grid.RowDefinitions>
-
- <Frame
- CornerRadius="5"
- HasShadow="False"
- Margin="0"
- x:Name="toolFrame"
- Grid.Row="0"
- Grid.Column="0"
- BorderColor="{Binding Source={RelativeSource AncestorType={x:Type local:MobileToolGrid}}, Path=BorderColor}"
- HeightRequest="{Binding Source={RelativeSource Self}, Path=Width}"
- BackgroundColor="{Binding AlertVisible, Converter={StaticResource BooleanToColorConverter}}"
- Padding="0">
- <Frame.Triggers>
- <DataTrigger TargetType="Frame" Binding="{Binding IsEnabled}" Value="False">
- <Setter Property="BackgroundColor" Value="LightGray" />
- </DataTrigger>
- <DataTrigger TargetType="Frame" Binding="{Binding AlertVisible}" Value="True">
- <Setter Property="BackgroundColor" Value="LightSalmon" />
- </DataTrigger>
- </Frame.Triggers>
- <Frame.GestureRecognizers>
- <TapGestureRecognizer Tapped="ToolItem_Tapped" />
- </Frame.GestureRecognizers>
- <Grid RowSpacing="0" ColumnSpacing="0">
-
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
-
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
-
- <Image
- x:Name="toolEntryImage"
- Grid.Row="0"
- Grid.Column="0"
- Grid.ColumnSpan="2"
- Grid.RowSpan="2"
- Source="{Binding Image}">
- <Image.Margin>
- <OnIdiom x:TypeArguments="Thickness">
- <OnIdiom.Phone>
- <OnPlatform x:TypeArguments="Thickness">
- <On Platform="iOS" Value="15,0"/>
- <On Platform="Android" Value="15,0"/>
- </OnPlatform>
- </OnIdiom.Phone>
- <OnIdiom.Tablet>
- <OnPlatform x:TypeArguments="Thickness">
- <On Platform="iOS" Value="30,15"/>
- <On Platform="Android" Value="30,15"/>
- </OnPlatform>
- </OnIdiom.Tablet>
- </OnIdiom>
- </Image.Margin>
-
- </Image>
-
- <Frame
- x:Name="indicatorFrame"
- Grid.Row="0"
- Grid.Column="1"
- HasShadow="False"
- VerticalOptions="Start"
- HorizontalOptions="End"
- CornerRadius="10"
- IsVisible="{Binding AlertVisible}"
- BackgroundColor="Yellow"
- BorderColor="{Binding Source={RelativeSource AncestorType={x:Type local:MobileToolGrid}}, Path=BorderColor}"
- Padding="0"
- Margin="4"
- HeightRequest="20"
- WidthRequest="20">
-
- <Label
- FontAttributes="Bold"
- TextColor="Red"
- FontSize="9"
- HorizontalTextAlignment="Center"
- VerticalTextAlignment="Center"
- Text="{Binding Alert}"
- WidthRequest="{Binding Source={RelativeSource Self}, Path=Height}"/>
-
- </Frame>
-
- <Label
- Grid.Row="2"
- Grid.Column="0"
- Grid.ColumnSpan="2"
- Text="{Binding Text}"
- FontSize="Micro"
- Margin="0,0,0,5"
- HorizontalTextAlignment="Center"
- VerticalTextAlignment="Start"
- TextColor="{Binding TextColor}">
- <Label.Triggers>
- <DataTrigger TargetType="Label" Binding="{Binding IsEnabled}" Value="False">
- <Setter Property="TextColor" Value="Gray" />
- </DataTrigger>
- </Label.Triggers>
- </Label>
-
- </Grid>
-
- </Frame>
-
- </Grid>
-
- </DataTemplate>
- </BindableLayout.ItemTemplate>
- </Grid>
- </ScrollView>
- </ContentView.Content>
- </ContentView>
|