CommunityToolkit/WindowsCommunityToolkit

DataGrid: DataGridDetails height can grow, but never shrink

Open

#4,235 opened on Sep 9, 2021

View on GitHub
 (1 comment) (1 reaction) (0 assignees)C# (5,708 stars) (1,403 forks)batch import
DataGrid :capital_abcd:bug :bug:help wanted

Description

Describe the bug

When using the RowDetailsVisibilityMode="VisibleWhenSelected" mode on <DataGrid /> and having a content with dynamic size, the content can grow but never shrinks. If the content shinks, the allocated space won't shrink. SEE ANIMAGED GIF BELOW, THE PROBLEM IS OBVIOUS.

Is this bug a regression in the toolkit? DON'T THINK SO

Steps to Reproduce

Can this be reproduced in the Sample App? YEP (check below)

Steps to reproduce the behavior:

  1. Take the WCT sample app and open the DataGridCode.bind file
  2. In the RowDetailsTemplate DataTemplate, add following lines just before the closing </StackPanel>:
           <Slider x:Name="height" Minimum="0" Maximum="200" StepFrequency="1" Value="10" />
           <Rectangle Fill="Red" Height="{Binding Value, ElementName=height}" />
    
  3. Launch the WCT sample app + open the DataGrid sample
  4. Using the Properties pane, set the RowDetailsVisibilityMode to VisibleWhenSelected
  5. Select any row in the data grid
  6. Play with the slider an observe the resizing of the row details: DataGrid-Details-Expanding-Not-Shinking

Expected behavior

The row details should shrink to following its content.

Screenshots

Environment

Observed on Windows.

NuGet Package(s): Observed on 7.0.2

Package Version(s):

Windows 10 Build Number:

  • Fall Creators Update (16299)
  • April 2018 Update (17134)
  • October 2018 Update (17763)
  • May 2019 Update (18362)
  • May 2020 Update (19041) ---> 19043
  • Insider Build ({build_number})

App min and target version:

  • Fall Creators Update (16299)
  • April 2018 Update (17134)
  • October 2018 Update (17763)
  • May 2019 Update (18362)
  • May 2020 Update (19041)
  • Insider Build ({build_number})

Device form factor:

  • Desktop
  • Xbox
  • Surface Hub
  • IoT

Visual Studio version:

  • 2017 (15.{minor_version})
  • 2019 (16.{minor_version})
  • 2022 (17.{minor_version})

Additional context

Contributor guide