/// <summary> /// OnErrorClicked is invoked when an error in the ValidationSummary is clicked, via either the mouse or keyboard. /// </summary> /// <param name="e">The FocusingInvalidControlEventArgs for the event.</param> protected virtual void OnFocusingInvalidControl(FocusingInvalidControlEventArgs e) { EventHandler <FocusingInvalidControlEventArgs> handler = this.FocusingInvalidControl; if (handler != null) { handler(this, e); } }
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); // Raise the AutomationPeer event ValidationSummaryAutomationPeer peer = ValidationSummaryAutomationPeer.FromElement(this) as ValidationSummaryAutomationPeer; if (peer != null && AutomationPeer.ListenerExists(AutomationEvents.InvokePatternOnInvoked)) { peer.RaiseAutomationEvent(AutomationEvents.InvokePatternOnInvoked); } // 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]; } } } }
internal void ValidationSummary_FocusingInvalidControl(object sender, FocusingInvalidControlEventArgs e) { _grid.ValidationSummary_FocusingInvalidControl(sender, e); }
/// <summary> /// Handles the ValidationSummary's FocusingInvalidControl event and begins edit on the cells /// that are associated with the selected error. /// </summary> /// <param name="sender">ValidationSummary</param> /// <param name="e">FocusingInvalidControlEventArgs</param> private void ValidationSummary_FocusingInvalidControl(object sender, FocusingInvalidControlEventArgs e) { Debug.Assert(this._validationSummary != null); if (this.EditingRow == null || !ScrollSlotIntoView(this.EditingRow.Slot, false /*scrolledHorizontally*/)) { return; } // We need to focus the DataGrid in case the focused element gets removed when we end edit. if ((this._editingColumnIndex == -1 || (Focus() && EndCellEdit(DataGridEditAction.Commit, true, true, true))) && e.Item != null && e.Target != null && this._validationSummary.Errors.Contains(e.Item)) { DataGridCell cell = e.Target.Control as DataGridCell; if (cell != null && cell.OwningGrid == this && cell.OwningColumn != null && cell.OwningColumn.IsVisible) { Debug.Assert(cell.ColumnIndex >= 0 && cell.ColumnIndex < this.ColumnsInternal.Count); // Begin editing the next relevant cell UpdateSelectionAndCurrency(cell.ColumnIndex, this.EditingRow.Slot, DataGridSelectionAction.None, true /*scrollIntoView*/); if (this._successfullyUpdatedSelection) { BeginCellEdit(new RoutedEventArgs()); if (!IsColumnDisplayed(this.CurrentColumnIndex)) { ScrollColumnIntoView(this.CurrentColumnIndex); } } } e.Handled = true; } }
/// <summary> /// OnErrorClicked is invoked when an error in the ValidationSummary is clicked, via either the mouse or keyboard. /// </summary> /// <param name="e">The FocusingInvalidControlEventArgs for the event.</param> protected virtual void OnFocusingInvalidControl(FocusingInvalidControlEventArgs e) { EventHandler<FocusingInvalidControlEventArgs> handler = this.FocusingInvalidControl; if (handler != null) { handler(this, e); } }
// // Summary: // Raises the System.Windows.Controls.ValidationSummary.FocusingInvalidControl event. // // Parameters: // e: // The event data. protected virtual void OnFocusingInvalidControl(FocusingInvalidControlEventArgs e) { }