I have written bunch of switch case statement, but I know this can be simplified, any guidance will be respected. I am fairly new to XAML.
switch (e.Key)
{
    case Key.Escape:
        this.DialogResult = false;
        break;
    case Key.Return:
        this.DialogResult = true;
        break;
    case Key.Back:
        if (ResultValue != null && ResultValue.Length > 0)
            ResultValue = ResultValue.Remove(ResultValue.Length - 1);
        if (isUserAccess)
        {
            if (UserAccessPasswordValue != null && UserAccessPasswordValue.Length > 0)
                UserAccessPasswordValue = UserAccessPasswordValue.Remove(UserAccessPasswordValue.Length - 1);
        }
        break;
    case Key.Space:
        if (!CheckOutputLength(ResultValue)) return;
            ResultValue += " ";
        break;
    case Key.NumPad0:
    case Key.D0:             
    case Key.NumPad1:
    case Key.D1:
    case Key.NumPad2:
    case Key.D2:
    case Key.NumPad3:
    case Key.D3:
    case Key.NumPad4:
    case Key.D4:
    case Key.NumPad5:
    case Key.D5:
    case Key.NumPad6:
    case Key.D6:
    case Key.NumPad7:
    case Key.D7:
    case Key.NumPad8:
    case Key.D8:
    case Key.NumPad9:
    case Key.D9:
    case Key.A:
    case Key.B:
    case Key.C:
    case Key.D:
    case Key.E:
    case Key.F:
    case Key.G:
    case Key.H:
    case Key.I:
    case Key.J:
    case Key.K:
    case Key.L:
    case Key.M:
    case Key.N:
    case Key.O:
    case Key.P:
    case Key.Q:
    case Key.R:
    case Key.S:
    case Key.T:
    case Key.U:
    case Key.V:
    case Key.W:
    case Key.X:
    case Key.Y:
    case Key.Z:
        CheckandAddValue(e.Key.ToString());
        break;
}
My attempt has too many errors. This is a custom key board and detects the user inputs. The above code works and I am able to get the required outcome but i know this can be made simpler.
My simplified attempt
if ((e.Key >= Key.A && e.Key <= Key.Z) || (e.Key >= Key.D0 && e.Key <= Key.D9) || (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9))
 
     
     
    