I have a UWP application where I am rotating an image to a 90 degree angle. I have this image and a Canvas inside a Grid because I want Canvas to be on top of the image so from the code I can create some thumb controls and do a drag an drop.
If I don't apply the rotate transform the image is aligned properly inside the Grid like shown below.
On the other hand if I specify a Rotate Transform, the image rotates but it never scales to the height and width of the container as shown below.
I saw this post here Rotating and scaling image but I don't know how to get it to work in UWP. Please help. Here is my xaml. Ultimately what I want is, after the image has been rotated it should fit to the dimensions of the Grid scaling the height and width.
Edit: Please see the solution here, that is exactly what I want in UWP. fit image height and width after rotating WPF
<Grid x:Name="gridBarImagePanel" Grid.Row="4" BorderBrush="Black" BorderThickness="2"
Height="476" Width="625">
<Image x:Name="BarCodeImage" Source="..\SampleImage\demo.png"
RenderTransformOrigin="0.54,0.40" Height="476" Width="625">
<Image.RenderTransform>
<RotateTransform Angle="90"></RotateTransform>
</Image.RenderTransform>
</Image>
<Canvas x:Name="cnvBarCodeImage" Canvas.ZIndex="100" VerticalAlignment="Stretch">
</Canvas>
</Grid>