question

GuoLearn-6547 avatar image
0 Votes"
GuoLearn-6547 asked HuiLiu-MSFT answered

WindowsXamlHost.RenderTransform <RotateTransform Angle="30"/> can not work

When WPF using WindowsXamlHost the <RotateTransform Angle="30"/> can not work, Can we made it RotateTransform ?

<Window
x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApp1"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
xmlns:xhost="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"
Width="800"
Height="450"
mc:Ignorable="d">
<Grid >
<xhost:WindowsXamlHost Width="400" Height="200" RenderTransformOrigin="0.5,0.5">
<xhost:WindowsXamlHost.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="30"/>
<TranslateTransform/>
</TransformGroup>
</xhost:WindowsXamlHost.RenderTransform>
</xhost:WindowsXamlHost>
</Grid>
</Window>

windows-wpf
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

HuiLiu-MSFT avatar image
0 Votes"
HuiLiu-MSFT answered

WinForms XAML Host and WPF XAML Host, allowing developers to embed UI written for UWP into existing WinForms/WPF applications.
For XAML Islands (WinForms and WPF), HWND is created for UWP controls. This will bring some unobvious effects. For example, if you rotate the UWP control, the HWND will not rotate with it, that is, the HWND needs to be larger to provide space for it. You could refer here.


If the response is helpful, please click "Accept Answer" and upvote it.
 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. 

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.