123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <?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:mobile="clr-namespace:InABox.Mobile;assembly=InABox.Mobile.Shared"
- x:Class="InABox.Mobile.MobileTabStrip"
- x:DataType="mobile:MobileTabStrip">
-
- <ContentView.Resources>
- <ResourceDictionary>
-
- <DataTemplate x:Key="VerticalTemplate" x:DataType="mobile:MobileTabStripItem">
- <Frame
- Grid.Column="{Binding Index}"
- HasShadow="False"
- Margin="0"
- Padding="5"
- BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
- BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
- CornerRadius="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='CornerRadius'}"
- IsClippedToBounds="True"
- VerticalOptions="Fill"
- HorizontalOptions="Fill">
-
- <Frame.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap"/>
- </Frame.GestureRecognizers>
-
- <Frame.Triggers>
- <DataTrigger TargetType="Frame" Binding="{Binding Selected}" Value="True">
- <Setter Property="BackgroundColor" Value="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SelectedBackground'}" />
- </DataTrigger>
- </Frame.Triggers>
-
- <Grid>
-
- <Grid.RowDefinitions>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
-
- <Image
- x:Name="_image"
- Source="{Binding Image}"
- Grid.Row="0"
- Aspect="AspectFit"
- BackgroundColor="Transparent"
- HeightRequest="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='ImageSize.Height'}"
- WidthRequest="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='ImageSize.Width'}">
- <Image.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap"/>
- </Image.GestureRecognizers>
- </Image>
-
- <Label
- x:Name="_label"
- Text="{Binding Text}"
- Grid.Row="1"
- FontSize="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='FontSize'}"
- FontAttributes="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='FontAttributes'}"
- HorizontalTextAlignment="Center"
- VerticalTextAlignment="Center"
- BackgroundColor="Transparent"
- TextColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedForeground'}">
- <Label.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap" />
- </Label.GestureRecognizers>
- <Label.Triggers>
- <DataTrigger TargetType="Label" Binding="{Binding Selected}" Value="True">
- <Setter Property="TextColor" Value="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SelectedForeground'}" />
- </DataTrigger>
- </Label.Triggers>
- </Label>
-
- </Grid>
- </Frame>
- </DataTemplate>
-
- <DataTemplate x:Key="HorizontalTemplate" x:DataType="mobile:MobileTabStripItem">
- <Frame
- Grid.Column="{Binding Index}"
- HasShadow="False"
- Margin="0"
- Padding="5"
- BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
- BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
- CornerRadius="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='CornerRadius'}"
- IsClippedToBounds="True"
- VerticalOptions="Fill"
- HorizontalOptions="Fill">
-
- <Frame.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap"/>
- </Frame.GestureRecognizers>
-
- <Frame.Triggers>
- <DataTrigger TargetType="Frame" Binding="{Binding Selected}" Value="True">
- <Setter Property="BackgroundColor" Value="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SelectedBackground'}" />
- </DataTrigger>
- </Frame.Triggers>
-
- <Grid>
-
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
-
- <Image
- x:Name="_image"
- Source="{Binding Image}"
- Grid.Column="0"
- Aspect="AspectFit"
- BackgroundColor="Transparent"
- HeightRequest="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='ImageSize.Height'}"
- WidthRequest="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='ImageSize.Width'}">
- <Image.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap"/>
- </Image.GestureRecognizers>
- </Image>
-
- <Label
- x:Name="_label"
- Text="{Binding Text}"
- Grid.Column="1"
- FontSize="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='FontSize'}"
- FontAttributes="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='FontAttributes'}"
- HorizontalTextAlignment="Center"
- VerticalTextAlignment="Center"
- BackgroundColor="Transparent"
- TextColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedForeground'}">
- <Label.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap" />
- </Label.GestureRecognizers>
- <Label.Triggers>
- <DataTrigger TargetType="Label" Binding="{Binding Selected}" Value="True">
- <Setter Property="TextColor" Value="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SelectedForeground'}" />
- </DataTrigger>
- </Label.Triggers>
- </Label>
-
- </Grid>
- </Frame>
- </DataTemplate>
-
- <DataTemplate x:Key="TextOnlyTemplate" x:DataType="mobile:MobileTabStripItem">
- <Frame
- Grid.Column="{Binding Index}"
- HasShadow="False"
- Margin="0"
- Padding="5"
- BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
- BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
- CornerRadius="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='CornerRadius'}"
- IsClippedToBounds="True"
- VerticalOptions="Fill"
- HorizontalOptions="Fill">
-
- <Frame.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap"/>
- </Frame.GestureRecognizers>
-
- <Frame.Triggers>
- <DataTrigger TargetType="Frame" Binding="{Binding Selected}" Value="True">
- <Setter Property="BackgroundColor" Value="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SelectedBackground'}" />
- </DataTrigger>
- </Frame.Triggers>
-
- <Label
- x:Name="_label"
- Text="{Binding Text}"
- FontSize="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='FontSize'}"
- FontAttributes="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='FontAttributes'}"
- HorizontalTextAlignment="Center"
- VerticalTextAlignment="Center"
- BackgroundColor="Transparent"
- TextColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedForeground'}">
- <Label.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap" />
- </Label.GestureRecognizers>
- <Label.Triggers>
- <DataTrigger TargetType="Label" Binding="{Binding Selected}" Value="True">
- <Setter Property="TextColor" Value="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SelectedForeground'}" />
- </DataTrigger>
- </Label.Triggers>
- </Label>
- </Frame>
- </DataTemplate>
-
- <DataTemplate x:Key="ImageOnlyTemplate" x:DataType="mobile:MobileTabStripItem">
- <Frame
- Grid.Column="{Binding Index}"
- HasShadow="False"
- Margin="0"
- Padding="5"
- BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
- BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
- CornerRadius="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='CornerRadius'}"
- IsClippedToBounds="True"
- VerticalOptions="Fill"
- HorizontalOptions="Fill">
-
- <Frame.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap"/>
- </Frame.GestureRecognizers>
-
- <Frame.Triggers>
- <DataTrigger TargetType="Frame" Binding="{Binding Selected}" Value="True">
- <Setter Property="BackgroundColor" Value="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SelectedBackground'}" />
- </DataTrigger>
- </Frame.Triggers>
-
- <Image
- x:Name="_image"
- Source="{Binding Image}"
- Aspect="AspectFit"
- BackgroundColor="Transparent"
- HeightRequest="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='ImageSize.Height'}"
- WidthRequest="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='ImageSize.Width'}">
- <Image.GestureRecognizers>
- <TapGestureRecognizer Tapped="DoTap"/>
- </Image.GestureRecognizers>
- </Image>
-
- </Frame>
- </DataTemplate>
-
- <mobile:MobileTabStripDataTemplateSelector
- x:Key="MobileTabStripDataTemplateSelector"
- x:Name="_mobileTabStripDataTemplateSelector"
- TextOnlyTemplate="{StaticResource TextOnlyTemplate}"
- ImageOnlyTemplate="{StaticResource ImageOnlyTemplate}"
- VerticalTemplate="{StaticResource VerticalTemplate}"
- HorizontalTemplate="{StaticResource HorizontalTemplate}"/>
-
- </ResourceDictionary>
- </ContentView.Resources>
- <ContentView.Content>
-
- <Frame
- HasShadow="False"
- Margin="0"
- BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='BorderColor'}"
- BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
- CornerRadius="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='CornerRadius'}"
- IsClippedToBounds="True">
- <Frame.Padding>
- <OnPlatform x:TypeArguments="Thickness">
- <OnPlatform.Platforms>
- <On Platform="iOS" Value="0" />
- <On Platform="Android" Value="1" />
- </OnPlatform.Platforms>
- </OnPlatform>
- </Frame.Padding>
-
- <Grid
- x:Name="_grid"
- ColumnSpacing="0"
- BindableLayout.ItemTemplateSelector="{StaticResource MobileTabStripDataTemplateSelector}">
-
- <!-- <BindableLayout.ItemTemplateSelector> -->
- <!-- <mobile:MobileTabStripDataTemplateSelector -->
- <!-- SelectedLayout="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='ItemsLayout'}" -->
- <!-- TextOnlyTemplate="{StaticResource TextOnlyTemplate}" -->
- <!-- ImageOnlyTemplate="{StaticResource ImageOnlyTemplate}" -->
- <!-- VerticalTemplate="{StaticResource VerticalTemplate}" -->
- <!-- HorizontalTemplate="{StaticResource HorizontalTemplate}"/> -->
- <!-- </BindableLayout.ItemTemplateSelector> -->
-
- </Grid>
-
- </Frame>
-
- </ContentView.Content>
- </ContentView>
|