Skip to content

DataGrid fixes for WinUI 3 usage #3374

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

Merged
merged 1 commit into from
Jul 1, 2020
Merged

Conversation

RBrid
Copy link
Contributor

@RBrid RBrid commented Jul 1, 2020

A few changes for the WinUI branch so that the DataGrid control can be used in a WinUI 3 app:

  • addressed some compilation warnings (casting event args to Control/ContentControl/FrameworkElement as recommended by compiler)
  • removed all usages of Window.Current which is null in WinUI3:
  • replaced usage of Window.Current.CoreWindow.PointerCursor with CoreWindow.GetForCurrentThread().PointerCursor
  • replaced usage of Window.Current.CoreWindow.GetKeyState with CoreWindow.GetForCurrentThread().GetKeyState

PR Type

  • Bugfix

What is the current behavior?

Application crashes because Window.Current == null causes null ref exceptions as soon as user tries to interact with the DataGrid.

What is the new behavior?

No more exception, as in regular UWP.

PR Checklist

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

@RBrid RBrid added bug 🐛 An unexpected issue that highlights incorrect behavior DataGrid 🔠 Issues on DataGrid control labels Jul 1, 2020
@RBrid RBrid requested review from azchohfi and michael-hawker July 1, 2020 00:28
@RBrid RBrid self-assigned this Jul 1, 2020
@ghost
Copy link

ghost commented Jul 1, 2020

Thanks RBrid for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost assigned azchohfi Jul 1, 2020
Copy link
Contributor

@azchohfi azchohfi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@RBrid RBrid merged commit 3755b7d into winui Jul 1, 2020
@delete-merged-branch delete-merged-branch bot deleted the user/regisb/DataGridWinUIFixes branch July 1, 2020 00:49
@michael-hawker michael-hawker added this to the WinUI3 milestone Jul 22, 2020
@michael-hawker michael-hawker modified the milestones: WinUI3, 7.1.2, 7.0 Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior DataGrid 🔠 Issues on DataGrid control
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants