C# WriteableBitmap上的变换
我正在WP7 mango中编写应用程序,并尝试在XAML中将加载的图像从binded转换为WriteableBitmap,例如:C# WriteableBitmap上的变换,c#,xaml,windows-phone-7,C#,Xaml,Windows Phone 7,我正在WP7 mango中编写应用程序,并尝试在XAML中将加载的图像从binded转换为WriteableBitmap,例如: <Grid> <ScrollViewer> <Image Source="{Binding SourceImage}"> <Image.RenderTransform> <RotateTransform Angle="{Binding
<Grid>
<ScrollViewer>
<Image Source="{Binding SourceImage}">
<Image.RenderTransform>
<RotateTransform Angle="{Binding RotateAngle}"/>
</Image.RenderTransform>
</Image>
</ScrollViewer>
</Grid>
在ViewModel中,我将角度与属性角度绑定,从滑块更改此值,但图像不旋转。已更改的提升属性工作正常。
当我使用从contets文件加载的图像(静态图像)时,它工作正常。真奇怪。我还不知道问题来自何处,但您可以使用投影代替渲染转换:
<Grid>
<ScrollViewer>
<Image Source="{Binding SourceImage}">
<Image.Projection>
<PlaneProjection RotationZ="{Binding RotateAngle}" />
</Image.Projection>
</Image>
</ScrollViewer>
</Grid>
我个人会选择第一个或第二个解决方案。我担心第三种解决方案可能会产生意想不到的副作用。非常感谢!我选择了将图像放在滚动面板内的网格中的方式。这很有效。你也应该开始接受答案。回答率为0%,人们很快就会停止回答你。。。
<Grid>
<ScrollViewer>
<ScrollViewer.RenderTransform>
<RotateTransform Angle="{Binding RotateAngle}" />
</ScrollViewer.RenderTransform>
<Image Source="{Binding SourceImage}" />
</ScrollViewer>
</Grid>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Image Source="{Binding SourceImage}">
<Image.RenderTransform>
<RotateTransform Angle="{Binding RotateAngle}" />
</Image.RenderTransform>
</Image>
</Grid>
</ScrollViewer>
public MainPage()
{
this.InitializeComponent();
this.ScrollViewer.RenderTransform = this.Image.RenderTransform;
}