Exemple #1
0
 protected override void OnOpened(RoutedEventArgs e)
 {
     foreach (object obj in (IEnumerable)this.Items)
     {
         CommandBarButtonBase commandBarButtonBase = obj as CommandBarButtonBase;
         if (commandBarButtonBase != null)
         {
             commandBarButtonBase.Update();
         }
     }
     CommandBarHelper.CollapseUnnecessarySeparators(this.Items);
     base.OnOpened(e);
 }
Exemple #2
0
        internal void UpdateState()
        {
            bool flag = true;

            foreach (object obj in (IEnumerable)this.Items)
            {
                CommandBarButtonBase commandBarButtonBase = obj as CommandBarButtonBase;
                if (commandBarButtonBase != null)
                {
                    commandBarButtonBase.Update();
                }
                else
                {
                    CommandBarMenu commandBarMenu = obj as CommandBarMenu;
                    if (commandBarMenu != null)
                    {
                        commandBarMenu.UpdateState();
                    }
                }
                MenuItem menuItem = obj as MenuItem;
                if (flag && menuItem != null && menuItem.Visibility == Visibility.Visible)
                {
                    flag = false;
                }
            }
            CommandBarHelper.CollapseUnnecessarySeparators(this.Items);
            this.IsEnabled = !flag;
            if (!this.isCollapsible)
            {
                return;
            }
            if (flag)
            {
                this.Visibility = Visibility.Collapsed;
            }
            else
            {
                this.Visibility = Visibility.Visible;
            }
        }