LayoutTransformer
Represents a control that applies a layout transformation to its Content.
Inherits: ContentControl
Constructors
public LayoutTransformer()
layoutTransformer = LayoutTransformer()
Initializes a new instance of the LayoutTransformer class.
Properties
private FrameworkElement Child { get; }
value = layoutTransformer.Child
Gets the child element being transformed.
public Transform LayoutTransform { get; set; }
value = layoutTransformer.LayoutTransform
layoutTransformer.LayoutTransform = value
Gets or sets the layout transform to apply on the LayoutTransformer control content.
Methods
public void ApplyLayoutTransform()
layoutTransformer.ApplyLayoutTransform()
Applies the layout transform on the LayoutTransformer control content.
protected override Size ArrangeOverride(Size finalSize)
result = layoutTransformer.ArrangeOverride(finalSize)
Provides the behavior for the "Arrange" pass of layout.
- finalSize
- The final area within the parent that this element should use to arrange itself and its children.
Returns: The actual size used.
private Size ComputeLargestTransformedSize(Size arrangeBounds)
result = layoutTransformer.ComputeLargestTransformedSize(arrangeBounds)
Compute the largest usable size (greatest area) after applying the transformation to the specified bounds.
- arrangeBounds
- Arrange bounds.
Returns: Largest Size possible.
private static void DiagnosticWriteLine(string message)
LayoutTransformer.DiagnosticWriteLine(message)
Outputs diagnostic info if DIAGNOSTICWRITELINE is defined.
- message
- Diagnostic message.
private Matrix GetTransformMatrix(Transform transform)
result = layoutTransformer.GetTransformMatrix(transform)
Walks the Transform(Group) and returns the corresponding Matrix.
- transform
- Transform(Group) to walk.
Returns: Computed Matrix.
private static bool IsSizeSmaller(Size a, Size b)
result = LayoutTransformer.IsSizeSmaller(a, b)
Returns true if Size a is smaller than Size b in either dimension.
- a
- Second Size.
- b
- First Size.
Returns: True if Size a is smaller than Size b in either dimension.
private static void LayoutTransformChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
LayoutTransformer.LayoutTransformChanged(o, e)
Handles changes to the Transform DependencyProperty.
- o
- Source of the change.
- e
- Event args.
private static bool MatrixHasInverse(Matrix matrix)
result = LayoutTransformer.MatrixHasInverse(matrix)
Implements WPF's Matrix.HasInverse on Silverlight.
- matrix
- Matrix to check for inverse.
Returns: True if the Matrix has an inverse.
private static Matrix MatrixMultiply(Matrix matrix1, Matrix matrix2)
result = LayoutTransformer.MatrixMultiply(matrix1, matrix2)
Implements WPF's Matrix.Multiply on Silverlight.
- matrix1
- First matrix.
- matrix2
- Second matrix.
Returns: Multiplication result.
protected override Size MeasureOverride(Size availableSize)
result = layoutTransformer.MeasureOverride(availableSize)
Provides the behavior for the "Measure" pass of layout.
- availableSize
- The available size that this element can give to child elements.
Returns: The size that this element determines it needs during layout, based on its calculations of child element sizes.
public override void OnApplyTemplate()
layoutTransformer.OnApplyTemplate()
Builds the visual tree for the LayoutTransformer control when a new template is applied.
private void ProcessTransform(Transform transform)
layoutTransformer.ProcessTransform(transform)
Processes the Transform to determine the corresponding Matrix.
- transform
- Transform to process.
private static Rect RectTransform(Rect rect, Matrix matrix)
result = LayoutTransformer.RectTransform(rect, matrix)
Implements WPF's Rect.Transform on Silverlight.
- rect
- Rect to transform.
- matrix
- Matrix to transform with.
Returns: Bounding box of transformed Rect.
private static Matrix RoundMatrix(Matrix matrix, int decimals)
result = LayoutTransformer.RoundMatrix(matrix, decimals)
Rounds the non-offset elements of a Matrix to avoid issues due to floating point imprecision.
- matrix
- Matrix to round.
- decimals
- Number of decimal places to round to.
Returns: Rounded Matrix.
Fields
private const double AcceptableDelta
value = LayoutTransformer.AcceptableDelta
Acceptable difference between two doubles.
private const int DecimalsAfterRound
value = LayoutTransformer.DecimalsAfterRound
Number of decimals to round the Matrix to.
public static readonly DependencyProperty LayoutTransformProperty
value = LayoutTransformer.LayoutTransformProperty
Identifies the LayoutTransform DependencyProperty.
private const string PresenterName
value = LayoutTransformer.PresenterName
Name of the Presenter template part.
private const string TransformRootName
value = LayoutTransformer.TransformRootName
Name of the TransformRoot template part.
private Size _childActualSize
value = layoutTransformer._childActualSize
Actual DesiredSize of Child element (the value it returned from its MeasureOverride method).
private ContentPresenter _contentPresenter
value = layoutTransformer._contentPresenter
ContentPresenter element for displaying the content.
private MatrixTransform _matrixTransform
value = layoutTransformer._matrixTransform
RenderTransform/MatrixTransform applied to _transformRoot.
private Matrix _transformation
value = layoutTransformer._transformation
Transformation matrix corresponding to _matrixTransform.
private Panel _transformRoot
value = layoutTransformer._transformRoot
Root element for performing transformations.