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: TextWrapping fixing issue when resizing #2791

Open
Scnck opened this issue Feb 8, 2019 · 6 comments
Open

DataGrid: TextWrapping fixing issue when resizing #2791

Scnck opened this issue Feb 8, 2019 · 6 comments
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior DataGrid 🔠 Issues on DataGrid control help wanted Issues identified as good community contribution opportunities

Comments

@Scnck
Copy link

Scnck commented Feb 8, 2019

What is the proper method of applying text wrapping so that when resizing a column to auto adjust the row height?

https://stackoverflow.com/questions/54584552/uwp-datagrid-textwrapping-rowheight-issues

<controls:DataGridTextColumn Width="300" IsReadOnly="True" Header="Description" Binding="{Binding Description}">
	<controls:DataGridTextColumn.ElementStyle>
		<Style TargetType="TextBlock">
			<Setter Property="TextWrapping" Value="Wrap" />
		</Style>
	</controls:DataGridTextColumn.ElementStyle>
</controls:DataGridTextColumn>
@RBrid RBrid added the DataGrid 🔠 Issues on DataGrid control label Feb 11, 2019
@Bmartin2013 Bmartin2013 added the question ❔ Issues or PR require more information label Mar 26, 2019
@Kyaa-dost Kyaa-dost added the no-recent-activity 📉 Open Issues that require attention label Oct 2, 2019
@RBrid RBrid added the bug 🐛 An unexpected issue that highlights incorrect behavior label Oct 11, 2019
@RBrid
Copy link
Contributor

RBrid commented Oct 11, 2019

I don't have a good workaround in mind for this. It looks like a bug in ...\WindowsCommunityToolkit\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\DataGrid\DataGridCellsPresenter.cs's protected override Size MeasureOverride(Size availableSize).

    if (double.IsNaN(this.OwningGrid.RowHeight))
    {
        // No explicit height values were set so we can autosize
        autoSizeHeight = true;
        measureHeight = double.PositiveInfinity;
        this.DesiredHeight = 0;   <-- missing line in the current code
    }

Adding that one line of code addresses the issue I believe. I am not 100% sure there are no bad side-effects yet.
The problem is that the line this.DesiredHeight = Math.Max(this.DesiredHeight, cell.DesiredSize.Height); starts with the original & old DesiredHeight instead of starting with 0.

@harinikmsft harinikmsft added help wanted Issues identified as good community contribution opportunities and removed no-recent-activity 📉 Open Issues that require attention question ❔ Issues or PR require more information labels Oct 16, 2019
@ghost
Copy link

ghost commented Apr 8, 2021

Thanks Scnck for patiently waiting while the team is still investigating the issue.

@anawishnoff @RBrid can we please have an update on this issue? Thanks

3 similar comments
@ghost
Copy link

ghost commented May 9, 2021

Thanks Scnck for patiently waiting while the team is still investigating the issue.

@anawishnoff @RBrid can we please have an update on this issue? Thanks

@ghost
Copy link

ghost commented Jun 8, 2021

Thanks Scnck for patiently waiting while the team is still investigating the issue.

@anawishnoff @RBrid can we please have an update on this issue? Thanks

@ghost
Copy link

ghost commented Jul 8, 2021

Thanks Scnck for patiently waiting while the team is still investigating the issue.

@anawishnoff @RBrid can we please have an update on this issue? Thanks

@SharpDevSa
Copy link

Looking for an update

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 help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

6 participants