diff --git a/src/Uno.UI/Extensions/UIViewExtensions.iOSmacOS.cs b/src/Uno.UI/Extensions/UIViewExtensions.iOSmacOS.cs index 9bd8be8c8dca..5748235b3e1c 100644 --- a/src/Uno.UI/Extensions/UIViewExtensions.iOSmacOS.cs +++ b/src/Uno.UI/Extensions/UIViewExtensions.iOSmacOS.cs @@ -639,6 +639,7 @@ StringBuilder AppendView(_View innerView) .Append(uiElement != null ? $" AvailableSize={uiElement.LastAvailableSize}" : "") .Append(uiElement?.NeedsClipToSlot ?? false ? " CLIPPED_TO_SLOT" : "") .Append(uiElement?.GetElementSpecificDetails()) + .Append(uiElement?.GetElementGridOrCanvasDetails()) .Append(uiElement?.RenderTransform.GetTransformDetails()) .AppendLine(); } diff --git a/src/Uno.UI/Extensions/ViewExtensions.Android.cs b/src/Uno.UI/Extensions/ViewExtensions.Android.cs index 3b307ff54e07..b330b7e722f6 100644 --- a/src/Uno.UI/Extensions/ViewExtensions.Android.cs +++ b/src/Uno.UI/Extensions/ViewExtensions.Android.cs @@ -638,9 +638,11 @@ void AppendView(View innerView, string s) .Append(fe != null && fe.TryGetPadding(out var p) && p != default ? $" Padding={p}" : "") .Append(u != null ? $" DesiredSize={u.DesiredSize.ToString("F1")}" : "") .Append(u != null && u.NeedsClipToSlot ? "CLIPPED_TO_SLOT" : "") - .Append(u != null && u.RenderTransform != null ? $"RENDER_TRANSFORM({u.RenderTransform.MatrixCore})" : "") .Append(u?.Clip != null ? $" Clip={u.Clip.Rect}" : "") .Append(u == null && vg != null ? $" ClipChildren={vg.ClipChildren}" : "") + .Append(u?.GetElementSpecificDetails()) + .Append(u?.GetElementGridOrCanvasDetails()) + .Append(u?.RenderTransform.GetTransformDetails()) .Append($" IsLayoutRequested={innerView.IsLayoutRequested}") .Append(innerView is TextBlock textBlock ? $" Text=\"{textBlock.Text}\"" : "") .AppendLine(); diff --git a/src/Uno.UI/Extensions/ViewExtensions.cs b/src/Uno.UI/Extensions/ViewExtensions.cs index 9d2e829c1d7e..d90540a16429 100644 --- a/src/Uno.UI/Extensions/ViewExtensions.cs +++ b/src/Uno.UI/Extensions/ViewExtensions.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.Linq; +using System.Text; using Uno.Extensions; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; @@ -41,8 +42,54 @@ internal static string GetElementSpecificDetails(this UIElement element) TextBlock textBlock => $" Text=\"{textBlock.Text}\" Foreground={textBlock.Foreground}", ScrollViewer scrollViewer => $" Extent={scrollViewer.ExtentWidth}x{scrollViewer.ExtentHeight} Offset={scrollViewer.ScrollOffsets}", Viewbox viewbox => $" Stretch={viewbox.Stretch}", + SplitView splitview => $" Mode={splitview.DisplayMode}", + Grid grid => GetGridDetails(grid), _ => "" }; + + string GetGridDetails(Grid grid) + { + string columns = default; + if (grid.ColumnDefinitions.Count > 1) + { + columns = " Cols=" + grid.ColumnDefinitions + .Select(x => x.Width.ToString()) + .JoinBy(","); + } + + string rows = default; + if (grid.RowDefinitions.Count > 1) + { + rows = " Rows=" + grid.RowDefinitions + .Select(x => x.Height.ToString()) + .JoinBy(","); + } + + return columns + rows; + } + } + + internal static string GetElementGridOrCanvasDetails(this UIElement element) + { + var sb = new StringBuilder(); + + CheckProperty(Grid.ColumnProperty); + CheckProperty(Grid.RowProperty); + CheckProperty(Grid.ColumnSpanProperty); + CheckProperty(Grid.RowSpanProperty); + CheckProperty(Canvas.TopProperty); + CheckProperty(Canvas.LeftProperty); + CheckProperty(Canvas.ZIndexProperty); + + void CheckProperty(DependencyProperty property) + { + if (element.ReadLocalValue(property) is int value) + { + sb.Append($" {property.OwnerType.Name}.{property.Name}={value}"); + } + } + + return sb.ToString(); } internal static string GetTransformDetails(this Transform transform) diff --git a/src/Uno.UI/Extensions/ViewExtensions.netstd.cs b/src/Uno.UI/Extensions/ViewExtensions.netstd.cs index 48dc31f1b07e..d874e0295ccd 100644 --- a/src/Uno.UI/Extensions/ViewExtensions.netstd.cs +++ b/src/Uno.UI/Extensions/ViewExtensions.netstd.cs @@ -101,6 +101,7 @@ StringBuilder AppendView(UIElement innerView) .Append(uiElement?.Clip != null ? $" Clip={uiElement.Clip.Rect}" : "") .Append(uiElement?.NeedsClipToSlot ?? false ? " CLIPPED_TO_SLOT" : "") .Append(uiElement?.GetElementSpecificDetails()) + .Append(uiElement?.GetElementGridOrCanvasDetails()) .Append(uiElement?.RenderTransform.GetTransformDetails()) .AppendLine(); } diff --git a/src/Uno.UI/UI/Xaml/GridLength.cs b/src/Uno.UI/UI/Xaml/GridLength.cs index 604b5b32030a..ce55218f19b7 100644 --- a/src/Uno.UI/UI/Xaml/GridLength.cs +++ b/src/Uno.UI/UI/Xaml/GridLength.cs @@ -133,16 +133,15 @@ public bool Equals(GridLength other) private string DebugDisplay => ToDisplayString(); - internal readonly string ToDisplayString() - { - var inner = GridUnitType switch + internal readonly string ToDisplayString() => $"GridLength({this})"; + + public override string ToString() => + GridUnitType switch { GridUnitType.Auto => "Auto", GridUnitType.Pixel => $"{Value:f1}px", GridUnitType.Star => $"{Value:f1}*", _ => "invalid" }; - return $"GridLength({inner})"; - } } }