MobileMenuButtonMenu.xaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. x:Class="InABox.Mobile.MobileMenuButtonMenu" Padding="5">
  6. <ContentView.BindingContext>
  7. <mobile:MobileMenuButtonMenuViewModel
  8. x:Name="_viewModel"
  9. LayoutChanged="_viewModel_OnLayoutChanged"
  10. ItemClicked="_viewModel_OnItemClicked"/>
  11. </ContentView.BindingContext>
  12. <ContentView.Content>
  13. <Grid
  14. x:Name="_menu"
  15. VerticalOptions="StartAndExpand"
  16. HorizontalOptions="StartAndExpand"
  17. Margin="0,5,0,0"
  18. RowSpacing="5"
  19. BindableLayout.ItemsSource = "{Binding VisibleItems}"
  20. >
  21. <BindableLayout.EmptyView>
  22. <Label
  23. FontSize="Small"
  24. Text="(No Options)"
  25. TextColor="Gray"/>
  26. </BindableLayout.EmptyView>
  27. <Grid.ColumnDefinitions>
  28. <ColumnDefinition Width="Auto"/>
  29. </Grid.ColumnDefinitions>
  30. <BindableLayout.ItemTemplate>
  31. <DataTemplate x:DataType="mobile:MobileMenuEntry">
  32. <StackLayout
  33. Orientation="Vertical"
  34. IsVisible="{Binding IsVisible}"
  35. HorizontalOptions="Fill"
  36. Grid.Row="{Binding Index}">
  37. <Label
  38. Text="{Binding Text}"
  39. VerticalOptions="CenterAndExpand"
  40. HorizontalOptions="Fill"
  41. HorizontalTextAlignment="Start"
  42. VerticalTextAlignment="Center"
  43. FontSize="Small"
  44. Padding="2,5,2,2"
  45. IsVisible="False"
  46. TextColor="Black">
  47. <Label.GestureRecognizers>
  48. <TapGestureRecognizer Tapped="TapGestureRecognizer_OnTapped" />
  49. </Label.GestureRecognizers>
  50. <Label.Triggers>
  51. <DataTrigger TargetType="Label" Binding="{Binding Type}" Value="Item">
  52. <Setter Property="IsVisible" Value="True" />
  53. </DataTrigger>
  54. </Label.Triggers>
  55. </Label>
  56. <BoxView
  57. HeightRequest="1"
  58. VerticalOptions="Center"
  59. HorizontalOptions="Fill"
  60. BackgroundColor="Gray"
  61. Opacity="0.5"
  62. Margin="2,5,2,2"
  63. IsVisible="False">
  64. <BoxView.Triggers>
  65. <DataTrigger TargetType="BoxView" Binding="{Binding Type}" Value="Separator">
  66. <Setter Property="IsVisible" Value="True" />
  67. </DataTrigger>
  68. </BoxView.Triggers>
  69. </BoxView>
  70. </StackLayout>
  71. </DataTemplate>
  72. </BindableLayout.ItemTemplate>
  73. </Grid>
  74. </ContentView.Content>
  75. </ContentView>