【发布时间】:2012-08-06 01:08:01
【问题描述】:
一般来说,您可以使用所谓的“透视变换”将 3-D 效果(x、y、z、rotationX、rotationY、rotationZ...)应用于任何UIElement:
<Image x:Name="img1" HorizontalAlignment="Left" Height="200" Width="200" Source="img1.jpg">
<Image.Projection>
<PlaneProjection CenterOfRotationY="3" RotationX="40"/>
</Image.Projection>
</Image>
但没有 Z 索引(Z 排序)! 当 UIElements 重叠时,它们无法正确呈现透视图。
在 AS3 中,我使用此函数对对象进行 zsort :
public function zSort():void
{
var i:uint;
var zList:Array = [];
for (i=0; i<this.numChildren; i++)
{
var mtx:Matrix3D = this.getChildAt(i).transform.getRelativeMatrix3D(this.parent);
zList.push( { sp:this.getChildAt(i), z:mtx.position.z } );
}
zList.sortOn("z", Array.NUMERIC | Array.DESCENDING);
for (i=0; i<this.numChildren; i++)
{
this.setChildIndex(zList[i].sp, i);
}
}
c#中是否有类似的解决方案?还是 Windows 8 中的工作方式不同?
我找到了这个 Silverlight 教程 "Using projection to build a 3D carousel in Silverlight 3" 图像似乎是 zindex 自动女巫不是在 WINRT 中发生的事情吗?
【问题讨论】:
标签: c# windows-8 z-index transform uielement