Skip to content

DataGridCell content bounding box does not grow if content is longer than the initial cell width #4913

Open
@ErrorEater

Description

@ErrorEater

Describe the bug

If the initial cell width is smaller than the content length of a DataGridCell the content bounding box doesn't grow to show the whole content when the cell width is increased by the user.

Regression

No response

Reproducible in sample app?

  • This bug can be reproduced in the sample app.

Steps to reproduce

<controls:DataGrid x:Name="RunningTasks"
				   AutoGenerateColumns="False"
				   GridLinesVisibility="Horizontal"
				   HorizontalGridLinesBrush="Black"
				   ItemsSource="{x:Bind ViewModel.Source, Mode=OneWay}"
				   IsReadOnly="True"
				   SelectionMode="Single"
				   Height="160">
	<controls:DataGrid.Columns>
		<controls:DataGridTextColumn
			Binding="{Binding Points, Converter={StaticResource StringFormatConverter}, ConverterParameter='{}{0:N0}'}"
			Header="Points" />
	</controls:DataGrid.Columns>
</controls:DataGrid>

Expected behavior

If the cell width is 100px and its content's width is 200px and when the user expands the column to see the whole content the bounding box around the content should grow to 200px, towards the direction where it is aligned to, to show the whole content. Currently it stays at 100px and doesn't grow, truncates the content.

Screenshots

image

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

2022

Visual Studio Build Number

17.6.5

Device form factor

Desktop

Nuget packages

<ItemGroup>
	<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
	<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
	<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" />
	<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0-preview.6.23329.7" />
	<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.230628000-preview1" />
	<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.25387-preview" />
	<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

Additional context

No response

Help us help you

No.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DataGrid 🔠Issues on DataGrid controlbug 🐛An unexpected issue that highlights incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions