Represents Backstage tab control.
Inheritance: System.Windows.Controls.Primitives.Selector
Esempio n. 1
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.Backstage = ((Fluent.BackstageTabControl)(target));
     return;
     }
     this._contentLoaded = true;
 }
Esempio n. 2
0
        private static void UnselectSelectedItem(BackstageTabControl backstageTabControl)
        {
            if (backstageTabControl?.SelectedItem == null)
            {
                return;
            }

            if (backstageTabControl.ItemContainerGenerator.ContainerFromItem(backstageTabControl.SelectedItem) is BackstageTabItem backstageTabItem)
            {
                backstageTabItem.IsSelected = false;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BackstageAdorner"/> class.
        /// </summary>
        /// <param name="adornedElement">Adorned element</param>
        /// <param name="backstage">Backstage</param>
        public BackstageAdorner(FrameworkElement adornedElement, Backstage backstage)
            : base(adornedElement)
        {
            KeyboardNavigation.SetTabNavigation(this, KeyboardNavigationMode.Contained);
            KeyboardNavigation.SetControlTabNavigation(this, KeyboardNavigationMode.Contained);
            KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.Contained);

            this.Backstage           = backstage;
            this.backstageContent    = this.Backstage.Content;
            this.backstageTabControl = this.backstageContent as BackstageTabControl
                                       ?? UIHelper.FindVisualChild <BackstageTabControl>(this.backstageContent);

            this.background = new Rectangle();

            if (this.backstageTabControl != null)
            {
                BindingOperations.SetBinding(this.background, Shape.FillProperty, new Binding
                {
                    Path   = new PropertyPath(Control.BackgroundProperty),
                    Source = this.backstageTabControl
                });

                BindingOperations.SetBinding(this.background, MarginProperty, new Binding
                {
                    Path   = new PropertyPath(BackstageTabControl.SelectedContentMarginProperty),
                    Source = this.backstageTabControl
                });
            }
            else
            {
                this.background.SetResourceReference(Shape.FillProperty, "WhiteBrush");
            }

            this.visualChildren = new VisualCollection(this)
            {
                this.background,
                this.backstageContent
            };
        }
Esempio n. 4
0
        // Handles IsSelected changed
        private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            BackstageTabItem container = (BackstageTabItem)d;
            bool             newValue  = (bool)e.NewValue;

            if (newValue)
            {
                BackstageTabControl backstage = container.Parent as BackstageTabControl;
                if ((backstage != null) && (backstage.SelectedItem != container))
                {
                    if (backstage.SelectedItem is BackstageTabItem)
                    {
                        (backstage.SelectedItem as BackstageTabItem).IsSelected = false;
                    }
                    backstage.SelectedItem = container;
                }
                container.OnSelected(new RoutedEventArgs(Selector.SelectedEvent, container));
            }
            else
            {
                container.OnUnselected(new RoutedEventArgs(Selector.UnselectedEvent, container));
            }
        }