internal bool ProcessCalendarKey(KeyRoutedEventArgs e)
{
if (DisplayMode == CalendarMode.Month)
{
if (LastSelectedDate.HasValue && DisplayDateInternal != null)
{
// If a blackout day is inactive, when clicked on it, the
// previous inactive day which is not a blackout day can get
// the focus. In this case we should allow keyboard
// functions on that inactive day
if (DateTimeHelper.CompareYearMonth(LastSelectedDate.Value, DisplayDateInternal) != 0 && FocusButton != null && !FocusButton.IsInactive)
{
return true;
}
}
}
// Some keys (e.g. Left/Right) need to be translated in RightToLeft mode
VirtualKey invariantKey = InteractionHelper.GetLogicalKey(FlowDirection, e.Key);
bool ctrl, shift;
CalendarExtensions.GetMetaKeyState(out ctrl, out shift);
switch (invariantKey)
{
case VirtualKey.Up:
{
ProcessUpKey(ctrl, shift);
return true;
}
case VirtualKey.Down:
{
ProcessDownKey(ctrl, shift);
return true;
}
case VirtualKey.Left:
{
ProcessLeftKey(shift);
return true;
}
case VirtualKey.Right:
{
ProcessRightKey(shift);
return true;
}
case VirtualKey.PageDown:
{
ProcessPageDownKey(shift);
return true;
}
case VirtualKey.PageUp:
{
ProcessPageUpKey(shift);
return true;
}
case VirtualKey.Home:
{
ProcessHomeKey(shift);
return true;
}
case VirtualKey.End:
{
ProcessEndKey(shift);
return true;
}
case VirtualKey.Enter:
case VirtualKey.Space:
{
return ProcessEnterKey();
}
}
return false;
}