Attach() public method

Attaches this adorner to the adorned element
public Attach ( ) : void
return void
示例#1
0
        void Show()
        {
            // Check whether the window is still active
            // (it prevent keytips showing during Alt-Tab'ing)
            if (!window.IsActive)
            {
                RestoreFocuses();
                return;
            }

            activeAdornerChain             = new KeyTipAdorner(ribbon, ribbon, null);
            activeAdornerChain.Terminated += OnAdornerChainTerminated;

            // Special behavior for backstage
            Backstage backstage = ribbon.Menu as Backstage;

            if (backstage != null && backstage.IsOpen)
            {
                string keys = KeyTip.GetKeys(backstage);
                if (!String.IsNullOrEmpty(keys))
                {
                    activeAdornerChain.Forward(KeyTip.GetKeys(backstage), false);
                }
                else
                {
                    activeAdornerChain.Attach();
                }
            }
            else
            {
                activeAdornerChain.Attach();
            }
        }
示例#2
0
        // Forward to the next element
        void Forward(UIElement element, bool click)
        {
            Detach();
            if (click)
            {
                element.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, null));
                element.UpdateLayout();
            }

            UIElement[] children = LogicalTreeHelper.GetChildren(element)
                                   .Cast <object>()
                                   .Where(x => x is UIElement)
                                   .Cast <UIElement>().ToArray();
            if (children.Length == 0)
            {
                Terminate(); return;
            }

            childAdorner = GetTopLevelElement(children[0]) != GetTopLevelElement(element) ?
                           new KeyTipAdorner(children[0], element, this) :
                           new KeyTipAdorner(element, element, this);

            if (childAdorner.keyTips.Count != 0)
            {
                Detach();
                childAdorner.Attach();
            }
            else
            {
                Terminate();
            }
        }
示例#3
0
        // Forward to the next element
        private void Forward(UIElement element, bool click)
        {
            Detach();
            if (click)
            {
                //element.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, null));
                var control = element as IKeyTipedControl;
                if (control != null)
                {
                    control.OnKeyTipPressed();
                }
                element.UpdateLayout();
            }

            var children = LogicalTreeHelper.GetChildren(element)
                           .Cast <object>()
                           .Where(x => x is UIElement)
                           .Cast <UIElement>().ToArray();

            if (children.Length == 0)
            {
                Terminate(); return;
            }

            childAdorner = GetTopLevelElement(children[0]) != GetTopLevelElement(element) ?
                           new KeyTipAdorner(children[0], element, this) :
                           new KeyTipAdorner(element, element, this);

            Detach();
            childAdorner.Attach();
        }
示例#4
0
 // Back to the previous adorner
 void Back()
 {
     if (parentAdorner != null)
     {
         Log("Back");
         Detach();
         parentAdorner.Attach();
     }
     else
     {
         Terminate();
     }
 }
示例#5
0
        // Back to the previous adorner
        public void Back()
        {
            var control = this.keyTipElementContainer as IKeyTipedControl;

            if (control != null)
            {
                control.OnKeyTipBack();
            }

            if (parentAdorner != null)
            {
                Log("Back");
                Detach();
                parentAdorner.Attach();
            }
            else
            {
                Terminate();
            }
        }
示例#6
0
        void Show()
        {
            // Check whether the window is still active
            // (it prevent keytips showing during Alt-Tab'ing)
            if (!window.IsActive)
            {
                RestoreFocuses();
                return;
            }

            activeAdornerChain             = new KeyTipAdorner(ribbon, ribbon, null);
            activeAdornerChain.Terminated += OnAdornerChainTerminated;

            if (ribbon.IsBackstageOpen)
            {
                activeAdornerChain.Forward(Ribbon.Localization.BackstageButtonKeyTip, false);
            }
            else
            {
                activeAdornerChain.Attach();
            }
        }
示例#7
0
        // Forward to the next element
        private void Forward(UIElement element, bool click)
        {
            Detach();
            if (click)
            {
                //element.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, null));
                var control = element as IKeyTipedControl;
                if (control != null) control.OnKeyTipPressed();
                element.UpdateLayout();
            }

            var children = LogicalTreeHelper.GetChildren(element)
                .Cast<object>()
                .Where(x => x is UIElement)
                .Cast<UIElement>().ToArray();
            if (children.Length == 0) { Terminate(); return; }

            childAdorner = GetTopLevelElement(children[0]) != GetTopLevelElement(element) ?
                new KeyTipAdorner(children[0], element, this) :
                new KeyTipAdorner(element, element, this);

            Detach();
            childAdorner.Attach();
        }
        void Show()
        {
            // Check whether the window is still active
            // (it prevent keytips showing during Alt-Tab'ing)
            if (!window.IsActive)
            {
                RestoreFocuses();
                return;
            }

            activeAdornerChain = new KeyTipAdorner(ribbon, ribbon, null);
            activeAdornerChain.Terminated += OnAdornerChainTerminated;

            // Special behavior for backstage
            Backstage backstage = ribbon.Menu as Backstage;
            if (backstage != null && backstage.IsOpen)
            {
                string keys = KeyTip.GetKeys(backstage);
                if (!String.IsNullOrEmpty(keys)) activeAdornerChain.Forward(KeyTip.GetKeys(backstage), false);
                else activeAdornerChain.Attach();
            }
            else activeAdornerChain.Attach();
        }
        void Show()
        {
            // Check whether the window is still active
            // (it prevent keytips showing during Alt-Tab'ing)
            if (!window.IsActive)
            {
                RestoreFocuses();
                return;
            }
            
            activeAdornerChain = new KeyTipAdorner(ribbon, ribbon, null);
            activeAdornerChain.Terminated += OnAdornerChainTerminated;

            if (ribbon.IsBackstageOpen) activeAdornerChain.Forward(Ribbon.Localization.BackstageButtonKeyTip, false);
            else activeAdornerChain.Attach();
        }
        // Forward to the next element
        void Forward(UIElement element, bool click)
        {
            Detach();
            if (click)
            {
                element.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, null));
                element.UpdateLayout();
            }

            UIElement[] children = LogicalTreeHelper.GetChildren(element)
                .Cast<object>()
                .Where(x => x is UIElement)
                .Cast<UIElement>().ToArray();
            if (children.Length == 0) { Terminate(); return; }
                    
            childAdorner = GetTopLevelElement(children[0]) != GetTopLevelElement(element) ? 
                new KeyTipAdorner(children[0], element, this) :
                new KeyTipAdorner(element, element, this);

            if (childAdorner.keyTips.Count != 0)
            {
                Detach();
                childAdorner.Attach();
            }
            else
            {
                Terminate();
            }
        }