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

DataGrid Not Displaying in WinUI3 Desktop #2703

Closed
eleanorleffler opened this issue Jun 17, 2020 · 5 comments
Closed

DataGrid Not Displaying in WinUI3 Desktop #2703

eleanorleffler opened this issue Jun 17, 2020 · 5 comments
Assignees
Labels
appModel-win32 Exclusive to WinUI 3 Win32 Desktop apps area-DataGrid DataGrid control product-winui3 WinUI 3 issues team-Controls Issue for the Controls team

Comments

@eleanorleffler
Copy link

Describe the bug

The CommunityToolKit DataGrid works in UWP but once transferred over to WinUI3 Desktop, the DataGrid does not display anything. See Screenshot#1 for current behavior.

The DataGrid is loading because the dataGrid_AutoGeneratingColumn event is called.

Steps to reproduce the bug

  1. Clone WinUI3 Problems DataGrid repository.
  2. Go to the DataGridWinUI folder.
  3. Open the DataGridWinUI solution in Visual Studio 2019 Preview.
  4. Build and run with Debug x64.
  5. You should see that the DataGrid does not appear.

Expected behavior

We expect to see the DataGrid filled with 4 customers, the same behavior as we saw in UWP. See Screenshot#2.

Build and run the DataGridUWP solution in the DataGridUWP folder to see expected behavior.

Screenshots

DataGridBlank
Screenshot#1 - Current Behavior

DataGridExpectedBehavior
Screenshot#2 - Expected Behavior

Version Info

NuGet package version:

[Microsoft.Toolkit.Uwp.UI.Controls.DataGrid 8.0.0-preview1]
[Microsoft.VCRTForwarders.140 1.0.6]
[Microsoft.WinUI 3.0.0-preview1.200515.3]

Targeting:

Target: Universal Windows
Target version: Windows 10, version 1809 (10.0; Build 17763)
Min version: Windows 10, version 1809 (10.0; Build 17763)

Windows 10 version Saw the problem?
Insider Build (xxxxx)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763) Yes
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Mobile
Xbox
Surface Hub
IoT
@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label Jun 17, 2020
@StephenLPeters StephenLPeters added area-DataGrid DataGrid control appModel-win32 Exclusive to WinUI 3 Win32 Desktop apps product-winui3 WinUI 3 issues team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jun 18, 2020
@RBrid RBrid self-assigned this Jun 29, 2020
@RBrid
Copy link
Contributor

RBrid commented Jul 6, 2020

This is caused by microsoft/CsWinRT#345. While we wait for that to be fixed, try to work around this problem by adding this line to an application's app.xaml file:
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml"/>

<Application
 x:Class="..."
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:local="using:...">
  <Application.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
        <!-- Other merged dictionaries here -->
        <ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml"/>
      </ResourceDictionary.MergedDictionaries>
      <!-- Other app resources here -->
    </ResourceDictionary>
  </Application.Resources>
</Application>

Sorry for the inconvenience.

@eleanorleffler
Copy link
Author

Hi @RBrid ,

Thank you for the workaround!

Just an update, the workaround allows the DataGrid to display! However, we have come across crashes when we click on a cell or scroll vertically. We also noticed when we programmatically add styling to the DataGridColumnHeader, the header disappears. Are these issues related to this original issue?

@RBrid
Copy link
Contributor

RBrid commented Jul 8, 2020

@eleanorleffler, please have a look at CommunityToolkit/WindowsCommunityToolkit#3374. Those changes in the WCT winui branch should address the crashes. But I am not aware of the DataGridColumnHeader styling problems. Feel free to open a new issue for that. Thanks, -R

@eleanorleffler
Copy link
Author

eleanorleffler commented Jul 13, 2020

@RBrid We will be looking out for the next release of the Community Toolkit and will be opening a new issue for that styling problem (if it still exists)! Thanks!

@anawishnoff
Copy link
Contributor

This bug has been fixed, and the fix will be available in our next release - WinUI 3 Preview 4. We're hoping to ship this preview release in early February. Thanks!

@anawishnoff anawishnoff added the fixed-internally This bug has been fixed, and the fix will be shipped in the next version of WinUI 3. label Feb 2, 2021
@bpulliam bpulliam removed the fixed-internally This bug has been fixed, and the fix will be shipped in the next version of WinUI 3. label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appModel-win32 Exclusive to WinUI 3 Win32 Desktop apps area-DataGrid DataGrid control product-winui3 WinUI 3 issues team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

7 participants