-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image can not rotate properly in LayoutTransformControl #18245
Comments
Was Transform Origin previously set? |
LayoutTransform has an Origin property which you may want to set to "50%, 50%" (I think this should be acceptable syntax, havent tested it yet) |
Unfortunately there is no Origin property in LayoutTransformControl and setting LayoutTransformControl's RenderTransformOrigin does not help. Although RotateTransform has CenterX and CenterY properties, they don't accept relative point. Setting them also makes no difference. |
<StackPanel>
<Slider x:Name="Rotate" Minimum="-360" Maximum="360"></Slider>
<Border BorderThickness="1" Width="100" Height="100" BorderBrush="Gray">
<LayoutTransformControl HorizontalAlignment="Center">
<Image>
<DrawingImage>
<DrawingImage.Drawing>
<GeometryDrawing Brush="Red" Geometry="M0,0 h10 v100 h-10 z" />
</DrawingImage.Drawing>
</DrawingImage>
</Image>
<LayoutTransformControl.LayoutTransform>
<RotateTransform Angle="{Binding #Rotate.Value}" />
</LayoutTransformControl.LayoutTransform>
</LayoutTransformControl>
</Border>
</StackPanel> Result: looks okay to me. |
Ah I see ONLY 90° is wrong, so should be a Math issue. Tip You may clone Avalonia and add your sample to |
Describe the bug
Put an Image control in LayoutTransformControl and set LayoutTransform to rotate 90 degree, the Image will show at a weird position.

To Reproduce
Create a new window and input these xaml.
Expected behavior
The Image should be place in the vertical and horizontal center of the Border.
Avalonia version
11.2.3
OS
Windows
Additional context
Adjusting the Stretch and HorizontalAlignment affects Image's position.
Putting a Panel or other control between LayoutTransformControl and Image can solve the problem.
The text was updated successfully, but these errors were encountered: