Conversation
Owner
|
@mavaddat in my opinion should always skip copy operation on a template column. shouldn't we? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes an issue #304 where pressing Ctrl+C inside an editable
TableViewTemplateColumncell causes a WinRT clipboard exception (CLIPBRD_E_CANT_OPEN, HRESULT0x800401D0) to escape the control and crash the application.What this PR changes
1. Add exception handling around
Clipboard.SetContent(Commit: Handle clipboard exceptions)
Clipboard access can fail for normal, expected reasons. Wrapping the call in a
try/catchprevents the application from crashing:This matches the defensive clipboard handling used in WPF, WinForms, UWP, and other frameworks.
2. Skip TableView‑level copy when a cell editor already handles Ctrl+C
(Commit: Skip copy on simple text fields)
When a
TextBox,PasswordBox, orRichEditBoxis focused, these controls already implement their own copy behavior. In such cases, TableView should not attempt to perform its own copy:This avoids duplicate clipboard operations and prevents the control from invoking its own copy logic unnecessarily.
Why this fix is correct
Conclusion
This PR makes
WinUI.TableViewmore robust by:The changes are minimal, safe, and improve the reliability of the control in real‑world applications.
Thank you for maintaining this project — happy to adjust anything if needed.