更新:2007 年 11 月
命名空间:
System.Windows.Media.Media3D 程序集:
PresentationCore(在 PresentationCore.dll 中)
用于 XAML 的 XMLNS:http://schemas.microsoft.com/winfx/xaml/presentation
<ContentPropertyAttribute("Model")> _
Public NotInheritable Class ModelUIElement3D _
Inherits UIElement3D
Dim instance As ModelUIElement3D
[ContentPropertyAttribute("Model")]
public sealed class ModelUIElement3D : UIElement3D
[ContentPropertyAttribute(L"Model")]
public ref class ModelUIElement3D sealed : public UIElement3D
/** @attribute ContentPropertyAttribute("Model") */
public final class ModelUIElement3D extends UIElement3D
public final class ModelUIElement3D extends UIElement3D
<ModelUIElement3D>
Model
</ModelUIElement3D>
.NET Framework 3.5 版中引入了 ModelUIElement3D。有关更多信息,请参见 .NET Framework 3.5 体系结构。
下面的示例演示如何使用 ModelUIElement3D 类创建两个多维数据集:
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera Position="8,3,0" LookDirection="-8,-3,0" />
</Viewport3D.Camera>
<!-- The container has the two cubes as its children -->
<ContainerUIElement3D MouseDown="ContainerMouseDown">
<ContainerUIElement3D.Transform>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D x:Name="containerRotation" Axis="0, 1, 0" Angle="0" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
</ContainerUIElement3D.Transform>
<!-- Cube 1 -->
<ModelUIElement3D MouseDown="Cube1MouseDown">
<ModelUIElement3D.Transform>
<TranslateTransform3D OffsetZ="1.5" />
</ModelUIElement3D.Transform>
<ModelUIElement3D.Model>
<GeometryModel3D Geometry="{StaticResource CubeMesh}">
<GeometryModel3D.Material>
<DiffuseMaterial x:Name="cube1Material" Brush="Blue" />
</GeometryModel3D.Material>
</GeometryModel3D>
</ModelUIElement3D.Model>
</ModelUIElement3D>
<!-- Cube 2 -->
<ModelUIElement3D MouseDown="Cube2MouseDown">
<ModelUIElement3D.Transform>
<TranslateTransform3D OffsetZ="-1.5" />
</ModelUIElement3D.Transform>
<ModelUIElement3D.Model>
<GeometryModel3D Geometry="{StaticResource CubeMesh}">
<GeometryModel3D.Material>
<DiffuseMaterial x:Name="cube2Material" Brush="Green" />
</GeometryModel3D.Material>
</GeometryModel3D>
</ModelUIElement3D.Model>
</ModelUIElement3D>
</ContainerUIElement3D>
<!-- Lights -->
<ModelVisual3D>
<ModelVisual3D.Content>
<PointLight Color="White" Position="3, 10, 4" />
</ModelVisual3D.Content>
</ModelVisual3D>
</Viewport3D>
多维数据集通过下面的事件处理程序来响应鼠标按下事件:
有关完整示例,请参见处理三维事件的示例。
System..::.Object
System.Windows.Threading..::.DispatcherObject
System.Windows..::.DependencyObject
System.Windows.Media.Media3D..::.Visual3D
System.Windows..::.UIElement3D
System.Windows.Media.Media3D..::.ModelUIElement3D
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
.NET Framework
受以下版本支持:3.5 SP1、3.0 SP1
参考
其他资源