internal MenuShellItem(MenuItem menuItem) { MenuItem = menuItem; MenuItem.Parent = this; FlyoutItem.SetIsVisible(this, FlyoutItem.GetIsVisible(menuItem)); SetBinding(TitleProperty, new Binding(nameof(MenuItem.Text), BindingMode.OneWay, source: menuItem)); SetBinding(IconProperty, new Binding(nameof(MenuItem.IconImageSource), BindingMode.OneWay, source: menuItem)); SetBinding(FlyoutIconProperty, new Binding(nameof(MenuItem.IconImageSource), BindingMode.OneWay, source: menuItem)); SetBinding(AutomationIdProperty, new Binding(nameof(MenuItem.AutomationId), BindingMode.OneWay, source: menuItem)); MenuItem.PropertyChanged += OnMenuItemPropertyChanged; }
void OnMenuItemPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == Shell.MenuItemTemplateProperty.PropertyName) { Shell.SetMenuItemTemplate(this, Shell.GetMenuItemTemplate(MenuItem)); } else if (e.PropertyName == TitleProperty.PropertyName) { OnPropertyChanged(MenuItem.TextProperty.PropertyName); } else if (e.PropertyName == FlyoutItem.IsVisibleProperty.PropertyName) { FlyoutItem.SetIsVisible(this, FlyoutItem.GetIsVisible(MenuItem)); } }
public FlyoutItemHandler(NativeComponentRenderer renderer, XF.FlyoutItem flyoutItemControl) : base(renderer, flyoutItemControl) { FlyoutItemControl = flyoutItemControl ?? throw new ArgumentNullException(nameof(flyoutItemControl)); }