示例#1
0
        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;
        }
示例#2
0
 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));
     }
 }
示例#3
0
 public FlyoutItemHandler(NativeComponentRenderer renderer, XF.FlyoutItem flyoutItemControl) : base(renderer, flyoutItemControl)
 {
     FlyoutItemControl = flyoutItemControl ?? throw new ArgumentNullException(nameof(flyoutItemControl));
 }