Browse Source
Merge pull request #6860 from ltetak/datagrid_layoutrounding
DataGridColumn - fix LayoutRoundedWidth with DPI scaling applied
pull/7094/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
3 deletions
-
src/Avalonia.Controls.DataGrid/DataGridColumn.cs
|
|
|
@ -14,6 +14,7 @@ using System.Linq; |
|
|
|
using System.Diagnostics; |
|
|
|
using Avalonia.Controls.Templates; |
|
|
|
using Avalonia.Controls.Utils; |
|
|
|
using Avalonia.Layout; |
|
|
|
using Avalonia.Markup.Xaml.MarkupExtensions; |
|
|
|
|
|
|
|
namespace Avalonia.Controls |
|
|
|
@ -858,9 +859,9 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
if (OwningGrid != null && OwningGrid.UseLayoutRounding) |
|
|
|
{ |
|
|
|
double roundedLeftEdge = Math.Floor(leftEdge + 0.5); |
|
|
|
double roundedRightEdge = Math.Floor(leftEdge + ActualWidth + 0.5); |
|
|
|
LayoutRoundedWidth = roundedRightEdge - roundedLeftEdge; |
|
|
|
var scale = LayoutHelper.GetLayoutScale(HeaderCell); |
|
|
|
var roundSize = LayoutHelper.RoundLayoutSize(new Size(leftEdge + ActualWidth, 1), scale, scale); |
|
|
|
LayoutRoundedWidth = roundSize.Width - leftEdge; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|