MobileTabStrip.xaml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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:mobile="clr-namespace:InABox.Mobile;assembly=InABox.Mobile.Shared"
  5. xmlns:ui="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"
  6. x:Class="InABox.Mobile.MobileTabStrip"
  7. x:DataType="mobile:MobileTabStrip">
  8. <ContentView.Content>
  9. <Frame
  10. HasShadow="False"
  11. Margin="0"
  12. BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
  13. BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SeparatorColor'}"
  14. CornerRadius="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='CornerRadius'}"
  15. IsClippedToBounds="True">
  16. <Frame.Padding>
  17. <OnPlatform x:TypeArguments="Thickness">
  18. <OnPlatform.Platforms>
  19. <On Platform="iOS" Value="0" />
  20. <On Platform="Android" Value="1" />
  21. </OnPlatform.Platforms>
  22. </OnPlatform>
  23. </Frame.Padding>
  24. <Grid x:Name="_grid" ColumnSpacing="0">
  25. <BindableLayout.ItemTemplate>
  26. <DataTemplate x:DataType="mobile:MobileTabStripItem">
  27. <Grid
  28. Margin="0"
  29. Grid.Column="{Binding Index}"
  30. VerticalOptions="Fill"
  31. HorizontalOptions="Fill">
  32. <Grid.ColumnDefinitions>
  33. <ColumnDefinition Width="*"/>
  34. </Grid.ColumnDefinitions>
  35. <Grid.RowDefinitions>
  36. <RowDefinition Height="*"/>
  37. </Grid.RowDefinitions>
  38. <Frame
  39. HasShadow="False"
  40. Margin="0"
  41. Padding="0"
  42. BorderColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
  43. BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SeparatorColor'}"
  44. CornerRadius="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='CornerRadius'}"
  45. IsClippedToBounds="True">
  46. <Label
  47. Grid.Row="0"
  48. x:Name="_label"
  49. Text="{Binding Text}"
  50. FontSize="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='FontSize'}"
  51. FontAttributes="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='FontAttributes'}"
  52. HorizontalTextAlignment="Center"
  53. VerticalTextAlignment="Center"
  54. BackgroundColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedBackground'}"
  55. TextColor="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='UnselectedForeground'}"
  56. Margin="0">
  57. <Label.GestureRecognizers>
  58. <TapGestureRecognizer Tapped="DoTap" />
  59. </Label.GestureRecognizers>
  60. <Label.Triggers>
  61. <DataTrigger TargetType="Label" Binding="{Binding Selected}" Value="True">
  62. <Setter Property="TextColor" Value="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SelectedForeground'}" />
  63. <Setter Property="BackgroundColor" Value="{Binding Source={RelativeSource AncestorType={x:Type mobile:MobileTabStrip}}, Path='SelectedBackground'}" />
  64. </DataTrigger>
  65. </Label.Triggers>
  66. </Label>
  67. </Frame>
  68. </Grid>
  69. </DataTemplate>
  70. </BindableLayout.ItemTemplate>
  71. </Grid>
  72. </Frame>
  73. </ContentView.Content>
  74. </ContentView>