CopyPastor

Detecting plagiarism made easy.

Score: 1.8231420516967773; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2023-12-04
by Michał Mucek

Original Post

Original - Posted on 2023-12-02
by Michał Mucek



            
Present in both answers; Present only in the new answer; Present only in the old answer;

The code below works for me in a WinUI 3 (Windows App SDK) application. It should work for UWP as well. It completely prevents the keyboard from showing, without blinking/flickering.
public sealed partial class CustomTextBox {
private void CustomTextBox_OnGotFocus(object sender, RoutedEventArgs e) { CoreInputView.GetForCurrentView().PrimaryViewShowing += BlockOnScreenKeyboard; }
private void CustomTextBox_OnLostFocus(object sender, RoutedEventArgs e) { CoreInputView.GetForCurrentView().PrimaryViewShowing -= BlockOnScreenKeyboard; }
private static void BlockOnScreenKeyboard(CoreInputView sender, CoreInputViewShowingEventArgs args) { args.TryCancel(); sender.TryHide(); }
... }
`args.TryCancel()` does the job alone but when the app loses focus, the keyboard appears, so `sender.TryHide()` is needed to eliminate this bad-looking behavior.
I've been fighting the same problem in a WinUI 3 (Windows App SDK) application.
I've managed to solve it with the code below. It should work for UWP as well. It completely prevents the keyboard from showing, without blinking/flickering.
public sealed partial class CustomTextBox {
private void CustomTextBox_OnGotFocus(object sender, RoutedEventArgs e) { CoreInputView.GetForCurrentView().PrimaryViewShowing += BlockOnScreenKeyboard; }
private void CustomTextBox_OnLostFocus(object sender, RoutedEventArgs e) { CoreInputView.GetForCurrentView().PrimaryViewShowing -= BlockOnScreenKeyboard; }
private static void BlockOnScreenKeyboard(CoreInputView sender, CoreInputViewShowingEventArgs args) { args.TryCancel(); sender.TryHide(); }
... }
`args.TryCancel()` does the job alone but when the app loses focus, the keyboard appears, so `sender.TryHide()` is needed to eliminate this bad-looking behavior.

        
Present in both answers; Present only in the new answer; Present only in the old answer;