@@ -9,9 +9,12 @@ namespace CommunityToolkit.WinUI.Controls;
99/// Control that implements support for transformations as if applied by LayoutTransform.
1010/// </summary>
1111[ ContentProperty ( Name = "Child" ) ]
12-
12+ [ TemplatePart ( Name = "LayoutRoot" , Type = typeof ( Panel ) ) ]
13+ [ TemplatePart ( Name = "MatrixTransform" , Type = typeof ( MatrixTransform ) ) ]
1314public partial class LayoutTransformControl : Control
1415{
16+ private static Size EmptySize => new Size ( ) ;
17+
1518 /// <summary>
1619 /// Value used to work around double arithmetic rounding issues.
1720 /// </summary>
@@ -45,7 +48,7 @@ public partial class LayoutTransformControl : Control
4548 /// <summary>
4649 /// Actual DesiredSize of Child element.
4750 /// </summary>
48- private Size _childActualSize = Size . Empty ;
51+ private Size _childActualSize = EmptySize ;
4952
5053 /// <summary>
5154 /// Initializes a new instance of the <see cref="LayoutTransformControl"/> class.
@@ -235,11 +238,11 @@ protected override Size MeasureOverride(Size availableSize)
235238 if ( _layoutRoot == null || child == null )
236239 {
237240 // No content, no size
238- return Size . Empty ;
241+ return EmptySize ;
239242 }
240243
241244 Size measureSize ;
242- if ( _childActualSize == Size . Empty )
245+ if ( _childActualSize == EmptySize )
243246 {
244247 // Determine the largest size after the transformation
245248 measureSize = ComputeLargestTransformedSize ( availableSize ) ;
@@ -301,7 +304,7 @@ protected override Size ArrangeOverride(Size finalSize)
301304 _layoutRoot . Arrange ( finalRect ) ;
302305
303306 // This is the first opportunity to find out the Child's true DesiredSize
304- if ( IsSizeSmaller ( finalSizeTransformed , child . RenderSize ) && ( Size . Empty == _childActualSize ) )
307+ if ( IsSizeSmaller ( finalSizeTransformed , child . RenderSize ) && ( EmptySize == _childActualSize ) )
305308 {
306309 // Unfortunately, all the work so far is invalid because the wrong DesiredSize was used
307310 // Make a note of the actual DesiredSize
@@ -313,7 +316,7 @@ protected override Size ArrangeOverride(Size finalSize)
313316 else
314317 {
315318 // Clear the "need to measure/arrange again" flag
316- _childActualSize = Size . Empty ;
319+ _childActualSize = EmptySize ;
317320 }
318321
319322 // Return result to perform the transformation
@@ -329,7 +332,7 @@ protected override Size ArrangeOverride(Size finalSize)
329332 private Size ComputeLargestTransformedSize ( Size arrangeBounds )
330333 {
331334 // Computed largest transformed size
332- Size computedSize = Size . Empty ;
335+ Size computedSize = EmptySize ;
333336
334337 // Detect infinite bounds and constrain the scenario
335338 bool infiniteWidth = double . IsInfinity ( arrangeBounds . Width ) ;
0 commit comments