Beispiel #1
0
        private void InvokeMenuOpenedClosedAutomationEvent(bool open)
        {
            AutomationEvents automationEvent = open ? AutomationEvents.MenuOpened : AutomationEvents.MenuClosed;

            if (AutomationPeer.ListenerExists(automationEvent))
            {
                System.Windows.Threading.DispatcherOperationCallback method = null;
                AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this);
                if (peer != null)
                {
                    if (open)
                    {
                        if (method == null)
                        {
                            method = delegate(object param)
                            {
                                peer.RaiseAutomationEvent(automationEvent);
                                return(null);
                            };
                        }
                        this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, method, null);
                    }
                    else
                    {
                        peer.RaiseAutomationEvent(automationEvent);
                    }
                }
            }
        }
        private static void OnIsAutomationFocusedChanged(DependencyObject dobj, DependencyPropertyChangedEventArgs e)
        {
            if (AutomationPeerCache._objThatIsBinding == dobj)
            {
                return;
            }
            AutomationPeer automationPeer = AutomationPeerCache.GetAutomationPeer(dobj) ?? UIElementAutomationPeer.FromElement(dobj as UIElement);

            if (automationPeer == null)
            {
                return;
            }
            if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged))
            {
                automationPeer.RaisePropertyChangedEvent(SelectionItemPatternIdentifiers.IsSelectedProperty, e.OldValue, e.NewValue);
                automationPeer.RaisePropertyChangedEvent(AutomationElementIdentifiers.HasKeyboardFocusProperty, e.OldValue, e.NewValue);
            }
            if (AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged))
            {
                automationPeer.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged);
            }
            if (!(automationPeer is ItemAutomationPeer) || !AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected))
            {
                return;
            }
            automationPeer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected);
        }
Beispiel #3
0
        private void InvokeMenuOpenedClosedAutomationEvent(bool open)
        {
            AutomationEvents automationEvent = open ? AutomationEvents.MenuOpened : AutomationEvents.MenuClosed;

            if (AutomationPeer.ListenerExists(automationEvent))
            {
                AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this);
                if (peer != null)
                {
                    if (open)
                    {
                        // We raise the event async to allow PopupRoot to hookup
                        Dispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object param)
                        {
                            peer.RaiseAutomationEvent(automationEvent);
                            return(null);
                        }), null);
                    }
                    else
                    {
                        peer.RaiseAutomationEvent(automationEvent);
                    }
                }
            }
        }
        internal void RaiseSelectionEvents(SelectionChangedEventArgs e)
        {
            int numSelected = 1;

            // Currently only single selection is supported
            // this.OwnerControl.SelectedDates.Count;

            if (ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected) && numSelected == 1)
            {
                var selectedDay = this.OwnerControl.GetMonthViewItemFromDate((DateTime)e.AddedItems[0]);

                if (selectedDay != null)
                {
                    var peer = FromElement(selectedDay);

                    if (peer != null)
                    {
                        peer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected);
                    }
                }
            }
            else
            {
                if (ListenerExists(AutomationEvents.SelectionItemPatternOnElementAddedToSelection))
                {
                    foreach (DateTime date in e.AddedItems)
                    {
                        var selectedDay = this.OwnerControl.GetMonthViewItemFromDate(date);

                        if (selectedDay != null)
                        {
                            var peer = FromElement(selectedDay);

                            if (peer != null)
                            {
                                peer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementAddedToSelection);
                            }
                        }
                    }
                }

                if (ListenerExists(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection))
                {
                    foreach (DateTime date in e.RemovedItems)
                    {
                        var removedDay = this.OwnerControl.GetMonthViewItemFromDate(date);

                        if (removedDay != null)
                        {
                            AutomationPeer peer = FromElement(removedDay);

                            if (peer != null)
                            {
                                peer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection);
                            }
                        }
                    }
                }
            }
        }
Beispiel #5
0
        private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ToolTip t = (ToolTip)d;

            if ((bool)e.NewValue)
            {
                if (t._parentPopup == null)
                {
                    t.HookupParentPopup();
                }
            }
            else
            {
                // When ToolTip is about to close but still hooked up - we need to raise Accessibility event
                if (AutomationPeer.ListenerExists(AutomationEvents.ToolTipClosed))
                {
                    AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(t);
                    if (peer != null)
                    {
                        peer.RaiseAutomationEvent(AutomationEvents.ToolTipClosed);
                    }
                }
            }

            OnVisualStatePropertyChanged(d, e);
        }
Beispiel #6
0
        /// <summary>
        /// This method is called when button is clicked.
        /// </summary>
        protected override void OnClick()
        {
            if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
            {
                AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this);
                if (peer != null)
                {
                    peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
                }
            }

            // base.OnClick should be called first.
            // Our default command for Cancel Button to close dialog should happen
            // after Button's click event handler has been called.
            // If there is excption and it's a Cancel button and RoutedCommand is null,
            // We will raise Window.DialogCancelCommand.
            try
            {
                base.OnClick();
            }
            finally
            {
                // When the Button RoutedCommand is null, if it's a Cancel Button, Window.DialogCancelCommand will
                // be the default command. Do not assign Window.DialogCancelCommand to Button.Command.
                // If in Button click handler user nulls the Command, we still want to provide the default behavior.
                if ((Command == null) && IsCancel)
                {
                    // Can't invoke Window.DialogCancelCommand directly. Have to raise event.
                    // Filed bug 936090: Commanding perf issue: can't directly invoke a command.
                    MS.Internal.Commands.CommandHelpers.ExecuteCommand(Window.DialogCancelCommand, null, this);
                }
            }
        }
Beispiel #7
0
        private void ReorderItems(ListView listControl, TreeViewNode targetNode, int position, int childIndex, bool isForwards)
        {
            int positionModifier = isForwards ? 1 : -1;
            var skippedItem      = listControl.ContainerFromIndex(position + positionModifier) as TreeViewItem;

            skippedItem?.Focus(FocusState.Keyboard);

            var parentNode = targetNode.Parent;
            var children   = (TreeViewNodeVector)parentNode.Children;

            children.RemoveAt(childIndex);
            children.InsertAt(childIndex + positionModifier, targetNode);
            listControl.UpdateLayout();

            var treeView = AncestorTreeView;
            var lvi      = treeView.ContainerFromNode(targetNode) as TreeViewItem;

            if (lvi != null)
            {
                var targetItem = lvi;
                targetItem.Focus(FocusState.Keyboard);
                ((TreeViewList)listControl).UpdateDropTargetDropEffect(false, false, targetItem);
                AutomationPeer ancestorPeer = FrameworkElementAutomationPeer.FromElement(listControl);
                ancestorPeer.RaiseAutomationEvent(AutomationEvents.Dropped);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Called before the <see cref="E:System.Windows.UIElement.Tap" /> event
        /// occurs.
        /// </summary>
        /// <param name="e">Event data for the event.</param>
        protected override void OnTapped(TappedRoutedEventArgs e)
        {
            base.OnTapped(e);

            if (this.ItemState != ItemState.Realized)
            {
                return;
            }

            if (e.Handled || this.manipulationStartedHandled)
            {
                this.manipulationStartedHandled = false;
                return;
            }

            this.OnTap(e.OriginalSource as UIElement, e.OriginalSource as UIElement, e.GetPosition(e.OriginalSource as UIElement));
            this.UpdateCheckBoxVisualState("Normal");

            AutomationPeer itemPeer = FrameworkElementAutomationPeer.FromElement(this);

            if (itemPeer != null)
            {
                itemPeer.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged);
            }
        }
Beispiel #9
0
        public void StartUITest()
        {
            //(sender as FrameworkElement).
            var obj = this.AssociatedObject as DependencyObject;
            //int count = VisualTreeHelper.GetChildrenCount( obj );
            //MessageBox.Show(count.ToString());



            var allObjects = GetElements(obj);

            foreach (var item in allObjects)
            {
                if (item is TextBlock)
                {
                    AutomationPeer peer =
                        FrameworkElementAutomationPeer.CreatePeerForElement(item as UIElement);
                    //TextBlockAutomationPeer peer
                    //    = FrameworkElementAutomationPeer.FromElement(item as UIElement) as TextBlockAutomationPeer;

                    //MessageBox.Show(peer.Owner.ToString());
                    peer.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged);


                    //TextBlockAutomationPeer textBlockPeer = new TextBlockAutomationPeer(txt);
                    //invokeProvider.Invoke();

                    //MessageBox.Show(cccccc.ToString());
                    //var prop = item.GetValue(ContentControl.ContentProperty);
                }
            }
        }
Beispiel #10
0
        internal void RaiseAutomationFocusChangedEvent(int slot, int column)
        {
            if (slot >= 0 && slot < this.OwningDataGrid.SlotCount &&
                column >= 0 && column < this.OwningDataGrid.ColumnsItemsInternal.Count &&
                this.OwningDataGrid.IsSlotVisible(slot))
            {
                if (this.OwningDataGrid.RowGroupHeadersTable.Contains(slot))
                {
                    DataGridRowGroupHeader header = this.OwningDataGrid.DisplayData.GetDisplayedElement(slot) as DataGridRowGroupHeader;
                    if (header != null)
                    {
                        AutomationPeer headerPeer = CreatePeerForElement(header);
                        if (headerPeer != null)
                        {
#if DEBUG_AUTOMATION
                            Debug.WriteLine(headerPeer.ToString() + ".RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged)");
#endif
                            headerPeer.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged);
                        }
                    }
                }
                else
                {
                    AutomationPeer cellPeer = GetCellPeer(slot, column);
                    if (cellPeer != null)
                    {
#if DEBUG_AUTOMATION
                        Debug.WriteLine(cellPeer.ToString() + ".RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged)");
#endif
                        cellPeer.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged);
                    }
                }
            }
        }
        internal void RaiseTabSelectionEvents()
        {
            AutomationPeer dataPeer = EventsSource;

            if (dataPeer != null)
            {
                if (OwningTab.IsSelected)
                {
                    dataPeer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected);
                }
                else
                {
                    dataPeer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection);
                }
            }
        }
Beispiel #12
0
 private void List_PreviewKeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter || e.Key == Key.Space)
     {
         Model?.DefaultActionAsync().DoNotWait();
         AutomationPeer?.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged);
     }
 }
Beispiel #13
0
        internal void RaiseSelectionEvents(SelectionChangedEventArgs e)
        {
            int numSelected = this.OwningPersianCalendar.SelectedDates.Count;
            int numAdded    = e.AddedItems.Count;

            if (AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected) && numSelected == 1 && numAdded == 1)
            {
                CalendarDayButton selectedButton = this.OwningPersianCalendar.FindDayButtonFromDay((DateTime)e.AddedItems[0]);

                if (selectedButton != null)
                {
                    AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(selectedButton);

                    if (peer != null)
                    {
                        peer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected);
                    }
                }
            }
            else
            {
                if (AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementAddedToSelection))
                {
                    foreach (DateTime date in e.AddedItems)
                    {
                        CalendarDayButton selectedButton = this.OwningPersianCalendar.FindDayButtonFromDay(date);

                        if (selectedButton != null)
                        {
                            AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(selectedButton);

                            if (peer != null)
                            {
                                peer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementAddedToSelection);
                            }
                        }
                    }
                }

                if (AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection))
                {
                    foreach (DateTime date in e.RemovedItems)
                    {
                        CalendarDayButton removedButton = this.OwningPersianCalendar.FindDayButtonFromDay(date);

                        if (removedButton != null)
                        {
                            AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(removedButton);

                            if (peer != null)
                            {
                                peer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection);
                            }
                        }
                    }
                }
            }
        }
        // Raise synchronized input automation events here.
        internal static void RaiseAutomationEvent(AutomationPeer peer)
        {
            if (peer != null)
            {
                switch (InputManager.SynchronizedInputState)
                {
                case SynchronizedInputStates.Handled:
                    peer.RaiseAutomationEvent(AutomationEvents.InputReachedTarget);
                    break;

                case SynchronizedInputStates.Discarded:
                    peer.RaiseAutomationEvent(AutomationEvents.InputDiscarded);
                    break;

                default:
                    peer.RaiseAutomationEvent(AutomationEvents.InputReachedOtherElement);
                    break;
                }
            }
        }
Beispiel #15
0
 private void ClickImplement()
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
     {
         AutomationPeer automationPeer = UIElementAutomationPeer.CreatePeerForElement(this);
         if (automationPeer != null)
         {
             automationPeer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
         }
     }
     base.OnClick();
 }
Beispiel #16
0
        private void AnnounceVisualElementChanged(object sender)
        {
            AutomationPeer peer = UIElementAutomationPeer.FromElement(sender as UIElement);

            if (peer == null)
            {
                return;
            }
            Dispatcher.Invoke(
                () => peer.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged)
                );
        }
Beispiel #17
0
        internal void RaiseAutomationCellSelectedEvent(int slot, int column)
        {
            AutomationPeer cellPeer = GetCellPeer(slot, column);

            if (cellPeer != null)
            {
#if DEBUG_AUTOMATION
                Debug.WriteLine(cellPeer.ToString() + ".RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected)");
#endif
                cellPeer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected);
            }
        }
Beispiel #18
0
        /// <summary>
        /// Raises InvokedAutomationEvent and call the base method to raise the Click event
        /// </summary>
        /// <ExternalAPI/>
        protected override void OnClick()
        {
            if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
            {
                AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this);
                if (peer != null)
                {
                    peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
                }
            }

            base.OnClick();
        }
        private void TextBlock_AnnounceChanged(object sender)
        {
            AutomationPeer peer = (sender as UIElement).Dispatcher.Invoke(
                () => UIElementAutomationPeer.FromElement(sender as UIElement));

            if (peer == null)
            {
                return;
            }
            _Context.Send(
                x => peer.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged),
                null);
        }
        /// <summary>
        /// Raise an automation peer event for the selection of a day button.
        /// </summary>
        /// <param name="calendar">
        /// The Calendar associated with this automation peer.
        /// </param>
        /// <param name="date">The selected date.</param>
        /// <param name="eventToRaise">The selection event to raise.</param>
        private static void RaiseDayButtonSelectionEvent(Calendar calendar, DateTime date, AutomationEvents eventToRaise)
        {
            CalendarDayButton button = calendar.FindDayButtonFromDay(date);

            if (button != null)
            {
                AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(button);
                if (peer != null)
                {
                    peer.RaiseAutomationEvent(eventToRaise);
                }
            }
        }
Beispiel #21
0
 protected override void OnClick()
 {
     RaiseEvent(new RoutedEventArgs(PreviewClickEvent, this));
     if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
     {
         AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this);
         if (peer != null)
         {
             peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
         }
     }
     Dispatcher.BeginInvoke(DispatcherPriority.Render, new DispatcherOperationCallback(InvokeClickAfterRender), false);
 }
Beispiel #22
0
        internal virtual void OnClickPrimary(object sender, RoutedEventArgs args)
        {
            var eventArgs = new SplitButtonClickEventArgs();

            Click?.Invoke(this, eventArgs);

            AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(this);

            if (peer != null)
            {
                peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
            }
        }
Beispiel #23
0
        /// <summary>
        ///     Updates the values of the rating items.
        /// </summary>
        private void UpdateValues()
        {
            IList <RatingItem> ratingItems = GetRatingItems().ToList();

            RatingItem oldSelectedItem = GetSelectedRatingItem();

            IEnumerable <Tuple <RatingItem, double> > itemAndWeights =
                EnumerableFunctions
                .Zip(
                    ratingItems,
                    ratingItems
                    .Select(ratingItem => 1.0)
                    .GetWeightedValues(Value.GetValueOrDefault()),
                    (item, percent) => Tuple.Create(item, percent));

            foreach (Tuple <RatingItem, double> itemAndWeight in itemAndWeights)
            {
                itemAndWeight.Item1.Value = itemAndWeight.Item2;
            }

            RatingItem newSelectedItem = GetSelectedRatingItem();

            // Notify when the selection changes
            if (oldSelectedItem != newSelectedItem)
            {
                if (newSelectedItem != null &&
                    AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected))
                {
                    AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(newSelectedItem);
                    if (peer != null)
                    {
                        peer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementSelected);
                    }
                }
                if (oldSelectedItem != null &&
                    AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection))
                {
                    AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(oldSelectedItem);
                    if (peer != null)
                    {
                        peer.RaiseAutomationEvent(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection);
                    }
                }
            }

            if (HoveredRatingItem == null)
            {
                DisplayValue = Value.GetValueOrDefault();
            }
        }
 /// <summary>Handles the <see cref="E:System.Windows.Documents.Hyperlink.Click" /> routed event.</summary>
 // Token: 0x06003041 RID: 12353 RVA: 0x000D8E2C File Offset: 0x000D702C
 protected virtual void OnClick()
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
     {
         AutomationPeer automationPeer = ContentElementAutomationPeer.CreatePeerForElement(this);
         if (automationPeer != null)
         {
             automationPeer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
         }
     }
     Hyperlink.DoNavigation(this);
     base.RaiseEvent(new RoutedEventArgs(Hyperlink.ClickEvent, this));
     CommandHelpers.ExecuteCommandSource(this);
 }
Beispiel #25
0
        internal static void RaiseAutomationInvokeEvent(UIElement element)
        {
            if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
            {
                AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(element);
                if (peer != null)
                {
#if DEBUG_AUTOMATION
                    Debug.WriteLine(peer.ToString() + ".RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked)");
#endif
                    peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
                }
            }
        }
        private void TryReadAutomationProperties(StackPanel stackPanel)
        {
            var textblocks = stackPanel?.Children.OfType <TextBlock>();

            if (textblocks != null)
            {
                AutomationPeer peer = null;

                foreach (TextBlock textBlock in textblocks)
                {
                    peer = TextBlockAutomationPeer.FromElement(textBlock);
                    peer?.RaiseAutomationEvent(AutomationEvents.MenuOpened);
                }
            }
        }
Beispiel #27
0
 // Token: 0x06005893 RID: 22675 RVA: 0x00188634 File Offset: 0x00186834
 private void OnPopupOpened(object source, EventArgs e)
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.ToolTipOpened))
     {
         AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this);
         if (peer != null)
         {
             base.Dispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object param)
             {
                 peer.RaiseAutomationEvent(AutomationEvents.ToolTipOpened);
                 return(null);
             }), null);
         }
     }
     this.OnOpened(new RoutedEventArgs(System.Windows.Controls.ToolTip.OpenedEvent, this));
 }
Beispiel #28
0
 /// <summary>Raises the <see cref="E:System.Windows.Controls.Primitives.ButtonBase.Click" /> event and initiates sorting. </summary>
 // Token: 0x06005CD7 RID: 23767 RVA: 0x001A1FBC File Offset: 0x001A01BC
 protected override void OnClick()
 {
     if (!this.SuppressClickEvent)
     {
         if (AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
         {
             AutomationPeer automationPeer = UIElementAutomationPeer.CreatePeerForElement(this);
             if (automationPeer != null)
             {
                 automationPeer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
             }
         }
         base.OnClick();
         if (this.Column != null && this.Column.DataGridOwner != null)
         {
             this.Column.DataGridOwner.PerformSort(this.Column);
         }
     }
 }
Beispiel #29
0
        private void OnPopupOpened(object source, EventArgs e)
        {
            // Raise Accessibility event
            if (AutomationPeer.ListenerExists(AutomationEvents.ToolTipOpened))
            {
                AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this);
                if (peer != null)
                {
                    // We raise the event async to allow PopupRoot to hookup
                    Dispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object param)
                    {
                        peer.RaiseAutomationEvent(AutomationEvents.ToolTipOpened);
                        return(null);
                    }), null);
                }
            }

            OnOpened(new RoutedEventArgs(OpenedEvent, this));
        }
Beispiel #30
0
        // Token: 0x06005872 RID: 22642 RVA: 0x00188288 File Offset: 0x00186488
        private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ToolTip toolTip = (ToolTip)d;

            if ((bool)e.NewValue)
            {
                if (toolTip._parentPopup == null)
                {
                    toolTip.HookupParentPopup();
                }
            }
            else if (AutomationPeer.ListenerExists(AutomationEvents.ToolTipClosed))
            {
                AutomationPeer automationPeer = UIElementAutomationPeer.CreatePeerForElement(toolTip);
                if (automationPeer != null)
                {
                    automationPeer.RaiseAutomationEvent(AutomationEvents.ToolTipClosed);
                }
            }
            Control.OnVisualStatePropertyChanged(d, e);
        }