Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PreviewKeyDown in the floating window has always IsRepeat = true #495

Open
cirartem opened this issue Dec 10, 2024 · 0 comments
Open

PreviewKeyDown in the floating window has always IsRepeat = true #495

cirartem opened this issue Dec 10, 2024 · 0 comments

Comments

@cirartem
Copy link

I found that the keyboard click event works differently in the main window and in the floating window. It works correctly in the main window, IsRepeat = false is returned on the first press, IsRepeat = true is returned on hold. In a floating window, IsRepeat = true is immediately returned.
I reproduced the behavior on the test program MVVMTestApp.

MainWindow.xaml change line 61

      <local:PanesTemplateSelector.FileViewTemplate>
          <DataTemplate>
              <StackPanel Orientation="Vertical">
                  <TextBlock Text="FileViewTemplate" />
                  <TextBox
                      Background="Transparent"
                      BorderThickness="0"
                      Text="{Binding TextContent, UpdateSourceTrigger=PropertyChanged}"
                      PreviewKeyDown="TextBox_PreviewKeyDown"/>
              </StackPanel>
          </DataTemplate>
      </local:PanesTemplateSelector.FileViewTemplate>

MainWindow.xaml.cs add

private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)  
{  
	Debug.WriteLine($"TextBox_PreviewKeyDown. sender={sender?.GetType()?.Name?.ToString()}; OriginalSource={(e.OriginalSource as UIElement)?.GetType()?.Name?.ToString()} Source={e.Source?.GetType()?.Name?.ToString()} Key={e.Key} IsRepeat={e.IsRepeat} Handled={e.Handled}");  
}

Output in console:
KeyDownBug

I found this bug in my program with the xceed 2.5 library, I tried to get around this bug for a long time, but I did not find a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant