Example #1
0
        private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var control = (DropDownButton)d;

            var oldValue = (bool)e.OldValue;
            var newValue = (bool)e.NewValue;

            (UIElementAutomationPeer.FromElement(control) as DropDownButtonAutomationPeer)?.RaiseToggleStatePropertyChangedEvent(oldValue, newValue);

            control.OnIsDropDownOpenChanged(newValue);
        }
Example #2
0
        private AutomationPeer GetWrapperPeer()
        {
            AutomationPeer   wrapperPeer = null;
            FrameworkElement wrapper     = GetWrapper();

            if (wrapper != null)
            {
                wrapperPeer = UIElementAutomationPeer.CreatePeerForElement(wrapper);
            }
            return(wrapperPeer);
        }
Example #3
0
 private void Dashboard_Loaded(object sender, RoutedEventArgs e)
 {
     // Move automation focus to the Dashboard so that screenreaders will announce that the
     // session has begun.
     if (AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged))
     {
         UIElementAutomationPeer
         .CreatePeerForElement(this)
         ?.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged);
     }
 }
Example #4
0
        private RibbonTabHeaderAutomationPeer GetWrapperPeer()
        {
            RibbonTabHeaderAutomationPeer wrapperPeer = null;
            RibbonTabHeader wrapper = GetWrapper();

            if (wrapper != null)
            {
                wrapperPeer = UIElementAutomationPeer.CreatePeerForElement(wrapper) as RibbonTabHeaderAutomationPeer;
            }
            return(wrapperPeer);
        }
Example #5
0
            protected override List <AutomationPeer> GetControlledPeersCore()
            {
                var controlledPeers = new List <AutomationPeer>();

                foreach (UIElement controlledElement in ((CustomSearchBox)Owner).ControlledElements)
                {
                    controlledPeers.Add(UIElementAutomationPeer.CreatePeerForElement(controlledElement));
                }

                return(controlledPeers);
            }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
        {
            base.OnItemsChanged(e);

            ListViewAutomationPeer lvPeer = UIElementAutomationPeer.FromElement(this) as ListViewAutomationPeer;

            if (lvPeer != null && lvPeer.ViewAutomationPeer != null)
            {
                lvPeer.ViewAutomationPeer.ItemsChanged(e);
            }
        }
Example #7
0
 /// <summary>
 /// Notify that the content has loaded
 /// </summary>
 private void FireAsyncContentLoadedEvent(AsyncContentLoadedState state)
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.AsyncContentLoaded))
     {
         UserControlAutomationPeer peer = UIElementAutomationPeer.FromElement(this) as UserControlAutomationPeer;
         if (peer != null)
         {
             peer.RaiseAsyncContentLoadedEvent(new AsyncContentLoadedEventArgs(state, state == AsyncContentLoadedState.Beginning ? 0 : 100));
         }
     }
 }
Example #8
0
 private void FireAsyncContentLoadedEventAtNewRecordAdded()
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.AsyncContentLoaded))
     {
         ListBoxAutomationPeer peer = UIElementAutomationPeer.FromElement(this.dgEvents) as ListBoxAutomationPeer;
         if (peer != null)
         {
             peer.RaiseAsyncContentLoadedEvent(new AsyncContentLoadedEventArgs(AsyncContentLoadedState.Completed, 100));
         }
     }
 }
 /// <summary>
 /// Notify the tree update when search is complete.
 /// </summary>
 private void FireAsyncContentLoadedEvent()
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.AsyncContentLoaded))
     {
         TreeViewAutomationPeer peer = UIElementAutomationPeer.FromElement(this.treeviewHierarchy) as TreeViewAutomationPeer;
         if (peer != null)
         {
             peer.RaiseAsyncContentLoadedEvent(new AsyncContentLoadedEventArgs(AsyncContentLoadedState.Completed, 100));
         }
     }
 }
        protected virtual void OnHasSubmenuChanged(bool oldHasSubmenu, bool newHasSubmenu)
        {
            var peer = UIElementAutomationPeer.FromElement(this) as DropDownCommandButtonAutomationPeer;

            if (peer != null)
            {
                peer.RaiseExpandCollapseStatePropertyChangedEvent(
                    oldHasSubmenu ? IsDropDownOpen ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed : ExpandCollapseState.LeafNode,
                    newHasSubmenu ? IsDropDownOpen ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed : ExpandCollapseState.LeafNode);
            }
        }
        private RibbonContextualTabGroupAutomationPeer GetWrapperPeer()
        {
            RibbonContextualTabGroupAutomationPeer wrapperPeer = null;
            RibbonContextualTabGroup wrapper = GetWrapper();

            if (wrapper != null)
            {
                wrapperPeer = UIElementAutomationPeer.CreatePeerForElement(wrapper) as RibbonContextualTabGroupAutomationPeer;
            }
            return(wrapperPeer);
        }
Example #12
0
        /// <summary>
        /// Handles IsOpen propertyu changes
        /// </summary>
        /// <param name="d">Object</param>
        /// <param name="e">The event data</param>
        private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var groupBox = (RibbonGroupBox)d;

            var oldValue = (bool)e.OldValue;
            var newValue = (bool)e.NewValue;

            groupBox.OnIsDropDownOpenChanged();

            (UIElementAutomationPeer.FromElement(groupBox) as Fluent.Automation.Peers.RibbonGroupBoxAutomationPeer)?.RaiseExpandCollapseAutomationEvent(oldValue, newValue);
        }
        // Token: 0x06005F4A RID: 24394 RVA: 0x001AB80C File Offset: 0x001A9A0C
        private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RangeBase rangeBase = (RangeBase)d;
            RangeBaseAutomationPeer rangeBaseAutomationPeer = UIElementAutomationPeer.FromElement(rangeBase) as RangeBaseAutomationPeer;

            if (rangeBaseAutomationPeer != null)
            {
                rangeBaseAutomationPeer.RaiseValuePropertyChangedEvent((double)e.OldValue, (double)e.NewValue);
            }
            rangeBase.OnValueChanged((double)e.OldValue, (double)e.NewValue);
        }
Example #14
0
        private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var control = (DropDownButton)d;

            var oldValue = (bool)e.OldValue;
            var newValue = (bool)e.NewValue;

            control.OnIsDropDownOpenChanged(newValue);

            (UIElementAutomationPeer.FromElement(control) as Fluent.Automation.Peers.RibbonDropDownButtonAutomationPeer)?.RaiseExpandCollapseAutomationEvent(oldValue, newValue);
        }
 private void FireAsyncContentLoadedEvent()
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.AsyncContentLoaded))
     {
         UserControlAutomationPeer peer = UIElementAutomationPeer.FromElement(this) as UserControlAutomationPeer;
         if (peer != null)
         {
             peer.RaiseAsyncContentLoadedEvent(new AsyncContentLoadedEventArgs(AsyncContentLoadedState.Completed, 100));
         }
     }
 }
        // In In RibbonMode only e first gallery if exist is accessible.
        protected override List <AutomationPeer> GetChildrenCore()
        {
            InRibbonGallery irg = (InRibbonGallery)Owner;

            if (irg.IsInInRibbonMode)
            {
                List <AutomationPeer> children = new List <AutomationPeer>();

                RibbonGallery firstGallery = irg.FirstGallery;
                if (firstGallery != null)
                {
                    AutomationPeer galleryPeer = UIElementAutomationPeer.CreatePeerForElement(firstGallery);
                    if (galleryPeer != null)
                    {
                        children.Add(galleryPeer);
                    }
                }

                RepeatButton scrollUpButton = irg.ScrollUpButton;
                if (scrollUpButton != null)
                {
                    AutomationPeer scrollUpButtonPeer = UIElementAutomationPeer.CreatePeerForElement(scrollUpButton);
                    if (scrollUpButtonPeer != null)
                    {
                        children.Add(scrollUpButtonPeer);
                    }
                }

                RepeatButton scrollDownButton = irg.ScrollDownButton;
                if (scrollDownButton != null)
                {
                    AutomationPeer scrollDownButtonPeer = UIElementAutomationPeer.CreatePeerForElement(scrollDownButton);
                    if (scrollDownButtonPeer != null)
                    {
                        children.Add(scrollDownButtonPeer);
                    }
                }

                ToggleButton partToggleButton = irg.PartToggleButton;
                if (partToggleButton != null)
                {
                    AutomationPeer partToggleButtonPeer = UIElementAutomationPeer.CreatePeerForElement(partToggleButton);
                    if (partToggleButtonPeer != null)
                    {
                        children.Add(partToggleButtonPeer);
                    }
                }

                return(children);
            }

            return(base.GetChildrenCore());
        }
Example #17
0
        private static void SetLivePropertyWorker(UIElement obj)
        {
            var peer = UIElementAutomationPeer.CreatePeerForElement(obj) as LiveTextBlockAutomationPeer;

            if (peer == null)
            {
                return;
            }

            CustomAutomationProperties.SetLiveSetting(obj, AutomationLiveSetting.Polite);
            peer.RaiseCustomAutomationEvent(CustomAutomationEvents.LiveRegionChangedEvent);
        }
Example #18
0
        private IntPtr OnWmGetObject(IntPtr wparam, IntPtr lparam)
        {
            IntPtr         result         = IntPtr.Zero;
            AutomationPeer automationPeer = UIElementAutomationPeer.CreatePeerForElement(this);

            if (automationPeer != null)
            {
                IRawElementProviderSimple interopChild = automationPeer.GetInteropChild();
                result = AutomationInteropProvider.ReturnRawElementProvider(this.CriticalHandle, wparam, lparam, interopChild);
            }
            return(result);
        }
Example #19
0
// ReSharper disable VirtualMemberNeverOverriden.Global
        protected virtual void OnStateChanged(ProgressState oldState, ProgressState newState)
// ReSharper restore VirtualMemberNeverOverriden.Global
        {
            var peer = UIElementAutomationPeer.FromElement(this) as ProgressAutomationPeer;

            if (peer != null)
            {
                peer.InvalidatePeer();
            }

            OnAnimatedStateChanged(newState);
        }
        /// <summary>
        ///     Called when <see cref="IsSelected"/> becomes true.
        ///     Default implementation fires the <see cref="Selected"/> event.
        /// </summary>
        /// <param name="e">Event arguments.</param>
        protected internal virtual void OnSelected(RoutedEventArgs e)
        {
            RaiseEvent(e);

            RibbonGalleryItemAutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this) as RibbonGalleryItemAutomationPeer;

            if (peer != null)
            {
                peer.RaiseAutomationIsSelectedChanged(true);
                peer.RaiseAutomationSelectionEvent(AutomationEvents.SelectionItemPatternOnElementSelected);
            }
        }
        protected virtual void OnClose()
        {
            Height = ActualHeight;

            if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
            {
                var peer = UIElementAutomationPeer.CreatePeerForElement(this);
                peer?.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
            }

            RaiseCloseEvent();
        }
Example #22
0
        // from https://stackoverflow.com/a/18305272
        private void ListBoxScrollToBottom(ListBox listBox)
        {
            ListBoxAutomationPeer svAutomation    = (ListBoxAutomationPeer)UIElementAutomationPeer.CreatePeerForElement(chatMessages);
            IScrollProvider       scrollInterface = (IScrollProvider)svAutomation.GetPattern(PatternInterface.Scroll);

            System.Windows.Automation.ScrollAmount scrollVertical   = System.Windows.Automation.ScrollAmount.LargeIncrement;
            System.Windows.Automation.ScrollAmount scrollHorizontal = System.Windows.Automation.ScrollAmount.NoAmount;
            if (scrollInterface.VerticallyScrollable)
            {
                scrollInterface.Scroll(scrollHorizontal, scrollVertical);
            }
        }
Example #23
0
 public static void RegisterFocusEvents(DependencyObject obj, AutomationPeer associatedPeer)
 {
     if (AutomationPeerCache.GetIsAutomationFocused(obj))
     {
         return;
     }
     if (AutomationPeerCache.GetAutomationPeer(obj) == null && UIElementAutomationPeer.FromElement(obj as UIElement) == null)
     {
         AutomationPeerCache.SetAutomationPeer(obj, associatedPeer);
     }
     AutomationPeerCache.RegisterFocusEvents(obj, "IsKeyboardFocused");
 }
Example #24
0
        private void ScrollToBottom()
        {
            var peer = UIElementAutomationPeer.CreatePeerForElement(this.listBox);
            // GetPatternでIScrollProviderを取得
            var scrollProvider = peer.GetPattern(PatternInterface.Scroll) as IScrollProvider;

            if (scrollProvider != null && scrollProvider.VerticallyScrollable)
            {
                scrollProvider?.SetScrollPercent(scrollProvider.HorizontalScrollPercent, 100);
                scrollProvider?.Scroll(ScrollAmount.NoAmount, ScrollAmount.LargeIncrement);
            }
        }
        public void RaiseItemsLayoutInvalidatedEvent()
        {
            var itemsPeer = UIElementAutomationPeer.FromElement(this) as
                            ListViewToggleableItemsAutomationPeer;

            foreach (Bird bird in this.ItemsSource)
            {
                // Have the item peer raise a LayoutInvalidated event.
                var itemPeer = itemsPeer.GetPeer(bird);
                itemPeer.RaiseItemLayoutInvalidatedEvent();
            }
        }
Example #26
0
        /// <summary>
        /// Handle the Time property change event.
        /// </summary>
        /// <param name="d">Time label whose time is changed.</param>
        /// <param name="e">Instance of <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> containing the data.</param>
        private static void OnTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TimeLabel lblTime = d as TimeLabel;

            if (lblTime != null)
            {
                if (e.NewValue == null && e.Property == ValueProperty)
                {
                    throw new ArgumentNullException(e.Property.ToString());
                }

                if (e.OldValue != e.NewValue)
                {
                    if (e.Property == NullIndexProperty)
                    {
                        lblTime.Value.NullIndex = (int)e.NewValue;
                    }
                    else if (e.Property == TimeValueProperty)
                    {
                        lblTime.Value.TimeValue = (DateTime)e.NewValue;
                    }
                    else if (e.Property == TimeTypeProperty)
                    {
                        lblTime.Value.TimeType = (TimeType)e.NewValue;
                    }
                    else if (e.Property == ValueProperty)
                    {
                        CuiTime time = e.NewValue as CuiTime;
                        if (time != null)
                        {
                            lblTime.TimeType  = time.TimeType;
                            lblTime.TimeValue = time.TimeValue;
                            lblTime.NullIndex = time.NullIndex;
                        }
                    }

                    lblTime.UpdateDisplayValue();

                    TimeLabelAutomationPeer peer;

#if SILVERLIGHT
                    peer = FrameworkElementAutomationPeer.FromElement(lblTime) as TimeLabelAutomationPeer;
#else
                    peer = UIElementAutomationPeer.FromElement(lblTime) as TimeLabelAutomationPeer;
#endif

                    if (peer != null)
                    {
                        peer.RaiseValueChangedEvent(e.OldValue.ToString(), e.NewValue.ToString());
                    }
                }
            }
        }
Example #27
0
 protected override void OnClick()
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
     {
         var peer = UIElementAutomationPeer.CreatePeerForElement(this);
         if (peer != null)
         {
             peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
         }
     }
     base.OnClick();
 }
Example #28
0
 private void ClickImplement()
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
     {
         AutomationPeer automationPeer = UIElementAutomationPeer.CreatePeerForElement(this);
         if (automationPeer != null)
         {
             automationPeer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
         }
     }
     base.OnClick();
 }
Example #29
0
        private void AnnounceVisualElementChanged(object sender)
        {
            AutomationPeer peer = UIElementAutomationPeer.FromElement(sender as UIElement);

            if (peer == null)
            {
                return;
            }
            Dispatcher.Invoke(
                () => peer.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged)
                );
        }
Example #30
0
        public void AddLog(string log)
        {
            this.theListBox.Items.Add(log);
            ListBoxAutomationPeer listBoxAutomationPeer = (ListBoxAutomationPeer)UIElementAutomationPeer.CreatePeerForElement(this.theListBox);
            IScrollProvider       pattern       = (IScrollProvider)listBoxAutomationPeer.GetPattern(PatternInterface.Scroll);
            ScrollAmount          scrollAmount  = ScrollAmount.LargeIncrement;
            ScrollAmount          scrollAmount1 = ScrollAmount.NoAmount;

            if (pattern.VerticallyScrollable)
            {
                pattern.Scroll(scrollAmount1, scrollAmount);
            }
        }