Reputation: 380
I have this <Path>
element in a xaml file. I would like to create a copy and flip it horizontally so that the shape will point in the other direction. The <Path>
has a really long Data
field so I was wondering if there was a way to flip one of the elements instead of just eyeballing the element and manually making it appear the same shape and size.
I looked into flipping the image programatically using RenderTransform
and ScaleTransform
, but I am afraid it might hinder the performance of the application especially during a window resize.
References: https://learn.microsoft.com/en-us/dotnet/framework/wpf/graphics-multimedia/transforms-overview
Is there a protocol or way I can translate the
Path
element'sData
field into its horizontally flipped opposite in a way that wonder hurt the performance of the application?
Upvotes: 0
Views: 1431
Reputation: 1819
If you want to mirror the shape you might want to try this:
<Path data= "...">
<Path.RenderTransform>
<ScaleTransform ScaleX="-1.0"/>
</Path.RenderTransform>
</Path>
This doesn't really hurt the performance, since all rendered elements are transformed at some point anyway.
Upvotes: 3