示例#1
0
        private void OnSelectionChanged()
        {
            this.Owner.OnPropertyChanged(new PropertyChangedEventArgs("SelectedDateRanges"));

            CurrentSelectionChangedEventArgs args = new CurrentSelectionChangedEventArgs();

            if (this.Owner.SelectedDateRange.HasValue)
            {
                args.NewSelection = this.Owner.SelectedDateRange.Value.StartDate;
            }

            EventHandler <CurrentSelectionChangedEventArgs> handler = this.SelectionChanged;

            if (handler != null)
            {
                handler(this.Owner, args);
            }

            if (AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected) ||
                AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementAddedToSelection))
            {
                RadCalendarAutomationPeer peer = FrameworkElementAutomationPeer.FromElement(this.Owner) as RadCalendarAutomationPeer;
                if (peer != null)
                {
                    peer.RaiseSelectionEvents(args);
                }
            }
        }
示例#2
0
        private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            var control = (NumericUpDown)obj;

            var oldValue = (double)args.OldValue;
            var newValue = (double)args.NewValue;

            #region Fire Automation events
            if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged))
            {
                var peer =
                    UIElementAutomationPeer.FromElement(control) as NumericUpDownAutomationPeer;

                if (peer != null)
                {
                    peer.RaisePropertyChangedEvent(
                        RangeValuePatternIdentifiers.ValueProperty,
                        oldValue,
                        newValue);
                }
            }
            #endregion

            var e = new RoutedPropertyChangedEventArgs <double>(
                oldValue, newValue, ValueChangedEvent);

            control.OnValueChanged(e);
        }
示例#3
0
        private static void OnValueChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            NumericUpDown nudCtrl = (NumericUpDown)obj;

            decimal oldValue = (decimal)args.OldValue;
            decimal newValue = (decimal)args.NewValue;

            #region Fire Automation events
            if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged))
            {
                NumericUpDownAutomationPeer peer =
                    UIElementAutomationPeer.FromElement(nudCtrl) as NumericUpDownAutomationPeer;

                if (peer != null)
                {
                    peer.RaisePropertyChangedEvent(
                        RangeValuePatternIdentifiers.ValueProperty,
                        (double)oldValue,
                        (double)newValue);
                }
            }
            #endregion

            RoutedPropertyChangedEventArgs <decimal> e = new RoutedPropertyChangedEventArgs <decimal>(
                oldValue, newValue, ValueChangedEvent);

            nudCtrl.OnValueChanged(e);

            nudCtrl.updateValueString();
        }
示例#4
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);
                    }
                }
            }
        }
示例#5
0
        /// <summary>
        ///     Property changed called back for IsSelected property
        /// </summary>
        private static void OnIsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            RibbonTab ribbonTab = (RibbonTab)sender;

            if (ribbonTab.IsSelected)
            {
                ribbonTab.OnSelected(new RoutedEventArgs(Selector.SelectedEvent, ribbonTab));
            }
            else
            {
                ribbonTab.OnUnselected(new RoutedEventArgs(Selector.UnselectedEvent, ribbonTab));
            }
            RibbonTabHeader header = ribbonTab.RibbonTabHeader;

            if (header != null)
            {
                header.CoerceValue(RibbonTabHeader.IsRibbonTabSelectedProperty);
            }

            // Raise UI automation events on this RibbonTab
            if (AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected) ||
                AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection))
            {
                RibbonTabAutomationPeer peer = RibbonTabAutomationPeer.CreatePeerForElement(ribbonTab) as RibbonTabAutomationPeer;
                if (peer != null)
                {
                    peer.RaiseTabSelectionEvents();
                }
            }
        }
示例#6
0
        private void OnIsExpandedChanged(object sender, EventArgs e)
        {
            this.NotifyPropertyChanged("IsExpanded");

            if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged))
            {
                DataGridGroupAutomationPeer groupAutomationPeer = this.CreateAutomationPeer();

                ExpandCollapseState oldExpandCollapseState;
                ExpandCollapseState newExpandCollapseState;

                if (this.IsExpanded)
                {
                    oldExpandCollapseState = ExpandCollapseState.Collapsed;
                    newExpandCollapseState = ExpandCollapseState.Expanded;
                }
                else
                {
                    oldExpandCollapseState = ExpandCollapseState.Expanded;
                    newExpandCollapseState = ExpandCollapseState.Collapsed;
                }

                groupAutomationPeer.RaisePropertyChangedEvent(
                    ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty,
                    oldExpandCollapseState, newExpandCollapseState);
            }
        }
示例#7
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);
        }
示例#8
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);
                    }
                }
            }
        }
示例#9
0
        private static void OnValueChanged(object sender, DependencyPropertyChangedEventArgs args)
        {
            DateTimePicker picker = sender as DateTimePicker;

            var newValue = (DateTime?)args.NewValue;

            if (newValue.HasValue && newValue != null)
            {
                picker.utcValue = DateTime.SpecifyKind(newValue.Value, DateTimeKind.Utc);
            }
            else
            {
                picker.utcValue = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
            }

            if (picker.IsInternalPropertyChange)
            {
                return;
            }

            var oldValue = (DateTime?)args.OldValue;

            picker.HandleValueChange(oldValue, newValue);

            if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged))
            {
                var peer = FrameworkElementAutomationPeer.FromElement(picker) as DateTimePickerAutomationPeer;
                if (peer != null)
                {
                    peer.RaiseSelectionAutomationEvent(oldValue.ToString(), newValue.ToString());
                }
            }
        }
示例#10
0
        /// <summary>
        /// A virtual function that is called when the selection is changed. Default behavior
        /// is to raise a SelectionChangedEvent
        /// </summary>
        /// <param name="e">The inputs for this event. Can be raised (default behavior) or processed
        ///   in some other way.</param>
        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            base.OnSelectionChanged(e);

            // In a single selection mode we want to move anchor to the selected element
            if (SelectionMode == SelectionMode.Single)
            {
                ItemInfo    info     = InternalSelectedInfo;
                ListBoxItem listItem = (info != null) ? info.Container as ListBoxItem : null;

                if (listItem != null)
                {
                    UpdateAnchorAndActionItem(info);
                }
            }

            if (AutomationPeer.ListenerExists(AutomationEvents.SelectionPatternOnInvalidated) ||
                AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected) ||
                AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementAddedToSelection) ||
                AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection))
            {
                ListBoxAutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this) as ListBoxAutomationPeer;
                if (peer != null)
                {
                    peer.RaiseSelectionEvents(e);
                }
            }
        }
        private void HotkeyTextBox_LosingFocus(object sender, RoutedEventArgs e)
        {
            if (lastValidSettings != null && (lastValidSettings.IsValid() || lastValidSettings.IsEmpty()))
            {
                HotkeySettings = lastValidSettings.Clone();
            }

            HotkeyTextBox.Text = hotkeySettings.ToString();
            if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged))
            {
                TextBoxAutomationPeer peer =
                    FrameworkElementAutomationPeer.FromElement(HotkeyTextBox) as TextBoxAutomationPeer;
                string textBoxChangeActivityId = "textBoxChangedOnLosingFocus";

                if (peer != null)
                {
                    peer.RaiseNotificationEvent(
                        AutomationNotificationKind.ActionCompleted,
                        AutomationNotificationProcessing.ImportantMostRecent,
                        HotkeyTextBox.Text,
                        textBoxChangeActivityId);
                }
            }

            _isActive = false;
        }
示例#12
0
        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);
        }
        private void OnselectionModelChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "SelectedIndices")
            {
                bool oldValue   = IsSelected;
                var  groupIndex = GetGroupIndex();
                bool newValue   = groupIndex >= 0 ? SelectionModel.IsSelected(groupIndex, RepeatedIndex).Value : false;

                if (oldValue != newValue)
                {
                    IsSelected = newValue;

                    // AutomationEvents.PropertyChanged is used as a value that means dont raise anything
                    AutomationEvents eventToRaise =
                        oldValue ?
                        (SelectionModel.SingleSelect ? AutomationEvents.PropertyChanged : AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection) :
                        (SelectionModel.SingleSelect ? AutomationEvents.SelectionItemPatternOnElementSelected : AutomationEvents.SelectionItemPatternOnElementAddedToSelection);

                    if (eventToRaise != AutomationEvents.PropertyChanged && AutomationPeer.ListenerExists(eventToRaise))
                    {
                        var peer = FrameworkElementAutomationPeer.CreatePeerForElement(this);
                        peer.RaiseAutomationEvent(eventToRaise);
                    }
                }
            }
        }
示例#14
0
        /// <summary>
        /// Called when the <see cref="ToggleButton.IsChecked"/> property changes.
        /// </summary>
        /// <param name="args">The event data that describes the property that changed, as well as old and new values.</param>
        protected void OnIsCheckedChanged(DependencyPropertyChangedEventArgs args)
        {
            if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged))
            {
                var peer = UIElementAutomationPeer.CreatePeerForElement(this);

                if (peer != null)
                {
                    var oldValue = (bool?)args.OldValue;
                    var newValue = (bool?)args.NewValue;

                    peer.RaisePropertyChangedEvent(
                        ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty,
                        (oldValue == true) ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed,
                        (newValue == true) ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed);
                }
            }

            SetToolTip();
            ToolTip toolTip = (ToolTip)this.ToolTip;

            if (toolTip.IsOpen)
            {
                // need to reset so content changes if already open
                toolTip.IsOpen = false;
                toolTip.IsOpen = true;
            }
        }
示例#15
0
        private void NavigationView_PaneClosed(Microsoft.UI.Xaml.Controls.NavigationView sender, object args)
        {
            if (!navigationViewInitialStateProcessed)
            {
                navigationViewInitialStateProcessed = true;
                return;
            }

            var peer = FrameworkElementAutomationPeer.FromElement(sender);

            if (peer == null)
            {
                peer = FrameworkElementAutomationPeer.CreatePeerForElement(sender);
            }

            if (AutomationPeer.ListenerExists(AutomationEvents.MenuClosed))
            {
                var loader = Windows.ApplicationModel.Resources.ResourceLoader.GetForCurrentView();
                peer.RaiseNotificationEvent(
                    AutomationNotificationKind.ActionCompleted,
                    AutomationNotificationProcessing.ImportantMostRecent,
                    loader.GetString("Shell_NavigationMenu_Announce_Collapse"),
                    "navigationMenuPaneClosed");
            }
        }
        private void OnselectionModelChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "SelectedIndices")
            {
                bool?oldValue  = IsSelected;
                var  indexPath = GetIndexPath();
                bool?newValue  = IsRealized(indexPath) ? SelectionModel.IsSelectedAt(indexPath) : false;

                if (oldValue != newValue)
                {
                    IsSelected = newValue;
                    bool oldValueAsBool = oldValue.HasValue && oldValue.Value;
                    bool newValueAsBool = newValue.HasValue && newValue.Value;
                    if (oldValueAsBool != newValueAsBool)
                    {
                        // AutomationEvents.PropertyChanged is used as a value that means dont raise anything
                        AutomationEvents eventToRaise =
                            oldValueAsBool ?
                            (SelectionModel.SingleSelect ? AutomationEvents.PropertyChanged : AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection) :
                            (SelectionModel.SingleSelect ? AutomationEvents.SelectionItemPatternOnElementSelected : AutomationEvents.SelectionItemPatternOnElementAddedToSelection);

                        if (eventToRaise != AutomationEvents.PropertyChanged && AutomationPeer.ListenerExists(eventToRaise))
                        {
                            var peer = FrameworkElementAutomationPeer.CreatePeerForElement(this);
                            peer.RaiseAutomationEvent(eventToRaise);
                        }
                    }
                }
            }
        }
示例#17
0
        // Handles IsSelected property changes
        private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var container = (RibbonTabItem)d;
            var newValue  = (bool)e.NewValue;

            if (newValue)
            {
                if (container.TabControlParent?.SelectedTabItem != null &&
                    ReferenceEquals(container.TabControlParent.SelectedTabItem, container) == false)
                {
                    container.TabControlParent.SelectedTabItem.IsSelected = false;
                }

                container.OnSelected(new RoutedEventArgs(Selector.SelectedEvent, container));
            }
            else
            {
                container.OnUnselected(new RoutedEventArgs(Selector.UnselectedEvent, container));
            }

            // Raise UI automation events on this RibbonTabItem
            if (AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected) ||
                AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection))
            {
                //SelectorHelper.RaiseIsSelectedChangedAutomationEvent(container.TabControlParent, container, newValue);
                var peer = UIElementAutomationPeer.CreatePeerForElement(container) as RibbonTabItemAutomationPeer;
                peer?.RaiseTabSelectionEvents();
            }
        }
示例#18
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);
                }
            }
        }
示例#19
0
        /// <summary>
        /// A virtual function that is called when the selection is changed. Default behavior
        /// is to raise a SelectionChangedEvent
        /// </summary>
        /// <param name="e">The inputs for this event. Can be raised (default behavior) or processed
        ///   in some other way.</param>
        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            base.OnSelectionChanged(e);
            if (IsKeyboardFocusWithin)
            {
                // If keyboard focus is within the control, make sure it is going to the correct place
                TabItem item = GetSelectedTabItem();
                if (item != null)
                {
                    item.SetFocus();
                }
            }
            UpdateSelectedContent();

            if (AutomationPeer.ListenerExists(AutomationEvents.SelectionPatternOnInvalidated) ||
                AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementSelected) ||
                AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementAddedToSelection) ||
                AutomationPeer.ListenerExists(AutomationEvents.SelectionItemPatternOnElementRemovedFromSelection))
            {
                TabControlAutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(this) as TabControlAutomationPeer;
                if (peer != null)
                {
                    peer.RaiseSelectionEvents(e);
                }
            }
        }
示例#20
0
 private void OnSelectionChanged(SelectionModel sender, SelectionModelSelectionChangedEventArgs args)
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.SelectionPatternOnInvalidated))
     {
         var peer = (SelectionContainerAutomationPeer)FrameworkElementAutomationPeer.CreatePeerForElement(this);
         peer.SelectionChanged(args);
     }
 }
示例#21
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);
                            }
                        }
                    }
                }
            }
        }
示例#22
0
 private void Announce(string name, string message)
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.MenuOpened) && _createLayoutAnnounce != null)
     {
         var peer = UIElementAutomationPeer.FromElement(_createLayoutAnnounce);
         AutomationProperties.SetName(_createLayoutAnnounce, name + " " + message);
         peer?.RaiseAutomationEvent(AutomationEvents.MenuOpened);
     }
 }
示例#23
0
 private void AnnounceSuccessfulLayoutCreation(string name)
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.MenuOpened))
     {
         var peer = UIElementAutomationPeer.FromElement(_createLayoutAnnounce);
         AutomationProperties.SetName(_createLayoutAnnounce, name + " " + FancyZonesEditor.Properties.Resources.Layout_Creation_Announce);
         peer?.RaiseAutomationEvent(AutomationEvents.MenuOpened);
     }
 }
示例#24
0
 internal void RaiseSelectionChanged(double oldIndex, double newIndex)
 {
     if (AutomationPeer.ListenerExists(AutomationEvents.PropertyChanged))
     {
         RaisePropertyChangedEvent(SelectionPatternIdentifiers.SelectionProperty,
                                   oldIndex,
                                   newIndex);
     }
 }
示例#25
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);
     }
 }
示例#26
0
 private void AnnounceError(string message)
 {
     ErrorTextBlock.Visibility = Visibility.Visible;
     ErrorTextBlock.Text       = message;
     if (AutomationPeer.ListenerExists(AutomationEvents.LiveRegionChanged))
     {
         var automationPeer = UIElementAutomationPeer.CreatePeerForElement(ErrorTextBlock);
         automationPeer?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
     }
 }
 /// <inheritdoc/>
 protected override void OnValueChanged(double oldValue, double newValue)
 {
     OnValueChanged(this);
     base.OnValueChanged(oldValue, newValue);
     if (AutomationPeer.ListenerExists(AutomationEvents.LiveRegionChanged))
     {
         var peer = FrameworkElementAutomationPeer.FromElement(this) as RadialGaugeAutomationPeer;
         peer?.RaiseValueChangedEvent(oldValue, newValue);
     }
 }
        void RaiseWindowClosedEvent(string displayString)
        {
            AutomationPeer autPeer = this;

            autPeer.RaiseNotificationEvent(AutomationNotificationKind.Other, AutomationNotificationProcessing.CurrentThenMostRecent, displayString, "InfoBarClosedActivityId");
            if (AutomationPeer.ListenerExists(AutomationEvents.WindowClosed))
            {
                RaiseAutomationEvent(AutomationEvents.WindowClosed);
            }
        }
示例#29
0
        private void ExecuteClick(object sender)
        {
            ListBox lb = sender as ListBox;

            if (lb != null)
            {
                ValidationSummaryItem vsi = lb.SelectedItem as ValidationSummaryItem;
                if (vsi != null && this.FocusControlsOnClick)
                {
                    int idx;
                    // Ensure the currently selected item source is valid
                    if (vsi.Sources.Count == 0)
                    {
                        // Clear the current ESI source if the ESI has none, such as when the ESI has changed
                        this._currentValidationSummaryItemSource = null;
                    }
                    else
                    {
                        // If the current ESI source is not part of the current set, select the first one by default.
                        idx = FindMatchingErrorSource(vsi.Sources, this._currentValidationSummaryItemSource);
                        if (idx < 0)
                        {
                            this._currentValidationSummaryItemSource = vsi.Sources[0];
                        }
                    }

                    // Raise the event
                    FocusingInvalidControlEventArgs e = new FocusingInvalidControlEventArgs(vsi, this._currentValidationSummaryItemSource);
                    this.OnFocusingInvalidControl(e);

#if OPENSILVER
                    // Raise the AutomationPeer event
                    ValidationSummaryAutomationPeer peer = ValidationSummaryAutomationPeer.FromElement(this) as ValidationSummaryAutomationPeer;
                    if (peer != null && AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked))
                    {
                        peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked);
                    }
#endif

                    // Focus the target, which will usually be the current ESI source or the overwritten one
                    if (!e.Handled && e.Target != null && e.Target.Control != null)
                    {
                        e.Target.Control.Focus();
                    }

                    // Update currently selected item, but only if there are multiple ESI sources.
                    if (vsi.Sources.Count > 0)
                    {
                        idx = FindMatchingErrorSource(vsi.Sources, e.Target);
                        idx = idx < 0 ? 0 : ++idx % vsi.Sources.Count;
                        this._currentValidationSummaryItemSource = vsi.Sources[idx];
                    }
                }
            }
        }
 /// <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));
         }
     }
 }