1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- namespace InABox.Mobile
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class MobileMenuButtonMenu
- {
- public IList<MobileMenuEntry> Items => _viewModel.Items;
-
- public IList<MobileMenuEntry> VisibleItems => _viewModel.VisibleItems;
-
- public MobileMenuButtonMenu()
- {
- InitializeComponent();
- }
- private void TapGestureRecognizer_OnTapped(object sender, EventArgs e)
- {
- if ((sender as Label)?.BindingContext is MobileMenuItem item)
- item.DoClicked();
- }
- private void _viewModel_OnLayoutChanged(object sender, MobileMenuButtonLayoutChangedEventArgs args)
- {
- _menu.RowDefinitions.Clear();
- for (int i=0; i< args.RowCount; i++)
- _menu.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto});
- }
- public event EventHandler ItemClicked;
-
- private void _viewModel_OnItemClicked(object sender, EventArgs e)
- {
- ItemClicked?.Invoke(this, EventArgs.Empty);
- }
- }
- }
|