protected override void SetFocusCore() { System.Windows.Controls.Calendar owner = OwningCalendar; if (owner.Focusable) { if (!owner.Focus()) { DateTime focusedDate; // Focus should have moved to either SelectedDate or DisplayDate if (owner.SelectedDate.HasValue && DateTimeHelper.CompareYearMonth(owner.SelectedDate.Value, owner.DisplayDateInternal) == 0) { focusedDate = owner.SelectedDate.Value; } else { focusedDate = owner.DisplayDate; } DateTimeAutomationPeer focusedItem = GetOrCreateDateTimeAutomationPeer(focusedDate, owner.DisplayMode, /*addParentInfo*/ false); FrameworkElement focusedButton = focusedItem.OwningButton; if (focusedButton == null || !focusedButton.IsKeyboardFocused) { throw new InvalidOperationException(SR.Get(SRID.SetFocusFailed)); } } } else { throw new InvalidOperationException(SR.Get(SRID.SetFocusFailed)); } }
// Token: 0x0600252B RID: 9515 RVA: 0x000B3338 File Offset: 0x000B1538 protected override void SetFocusCore() { System.Windows.Controls.Calendar owningCalendar = this.OwningCalendar; if (owningCalendar.Focusable) { if (!owningCalendar.Focus()) { DateTime date; if (owningCalendar.SelectedDate != null && DateTimeHelper.CompareYearMonth(owningCalendar.SelectedDate.Value, owningCalendar.DisplayDateInternal) == 0) { date = owningCalendar.SelectedDate.Value; } else { date = owningCalendar.DisplayDate; } DateTimeAutomationPeer orCreateDateTimeAutomationPeer = this.GetOrCreateDateTimeAutomationPeer(date, owningCalendar.DisplayMode, false); FrameworkElement owningButton = orCreateDateTimeAutomationPeer.OwningButton; if (owningButton == null || !owningButton.IsKeyboardFocused) { throw new InvalidOperationException(SR.Get("SetFocusFailed")); } } return; } throw new InvalidOperationException(SR.Get("SetFocusFailed")); }
private void ProcessTextBox() { SetSelectedDate(); this.IsDropDownOpen = true; _calendar.Focus(); }