Esempio n. 1
0
        internal MenuShellItem(MenuItem menuItem)
        {
            MenuItem        = menuItem;
            MenuItem.Parent = this;
            Shell.SetFlyoutItemIsVisible(this, Shell.GetFlyoutItemIsVisible(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;
        }
Esempio n. 2
0
 void OnMenuItemPropertyChanged(object sender, 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)
     {
         Shell.SetFlyoutItemIsVisible(this, Shell.GetFlyoutItemIsVisible(MenuItem));
     }
 }