How to do MatrixTransform inside XAML for RectangleGeometry inside MAUI

Agha Khan 166 Reputation points
2023-07-06T07:39:14.74+00:00

I used to do all types of transformations inside XAML file. But for some unknown reason, it is not available. for example

<Path Fill="#231F20" >

            <Path.Data>

                <RectangleGeometry Rect="271.87,42.76,3.1,11.55" >

                    <RectangleGeometry.Transform>

                        <MatrixTransform Matrix="0.9945 -0.1046 0.1046 0.9945 -3.5763 28.8519" />

                    </RectangleGeometry.Transform>

                </RectangleGeometry>

            </Path.Data>

        </Path>

Under MAUI Transform is not available. Kindly guide me on how to achieve Transform under MAUI.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,830 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 47,131 Reputation points Microsoft Vendor
    2023-07-07T02:32:08.6966667+00:00

    Hello,

    After investigating the RectangleGeometry class, there are no properties for Transform. Therefore, you cannot set MatrixTransform for the RectangleGeometry class.

    In MAUI, you could refer to Transform matrix for more details about how to use MatrixTransform in path.

    <Path Fill="#231F20" >
        <Path.RenderTransform>
            <MatrixTransform Matrix="0.9945 -0.1046 0.1046 0.9945 -3.5763 28.8519"/>
        </Path.RenderTransform>
        <Path.Data>
            <RectangleGeometry Rect="271.87,42.76,3.1,11.55" >
            </RectangleGeometry>
        </Path.Data>
    </Path>
    

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.