public static void DoShowWhenKeystroke(IAddSymbolView viewToShow, Key key) { if (key >= Key.A && key <= Key.Z || key >= Key.D0 && key <= Key.D9 || key >= Key.NumPad0 && key <= Key.NumPad9) { // When A-Z, 0-9 is keyed in, we show the element attached in this property if (viewToShow != null) { if (viewToShow.Visibility != Visibility.Visible) { viewToShow.Visibility = Visibility.Visible; viewToShow.SetSymbol(ConvertToChar(key)); } } } else if (key == Key.Escape) { // When ESC is keyed in, we hide the element attached in this property if (viewToShow != null) { viewToShow.Visibility = Visibility.Collapsed; } } }
public static void SetShowWhenKeystroke(DependencyObject element, IAddSymbolView value) { element.SetValue(ShowWhenKeystrokeProperty, value); }