Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ModelUIElement3D Class

Renders a 3-D model that supports input, focus, and events.

Namespace:  System.Windows.Media.Media3D
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public sealed class ModelUIElement3D : UIElement3D

ModelUIElement3D is introduced in the .NET Framework version 3.5. For more information, see .NET Framework 3.5 Architecture.

The following example shows how to create two cubes using the ModelUIElement3D class:

        <PerspectiveCamera Position="8,3,0" LookDirection="-8,-3,0" />

    <!-- The container has the two cubes as its children -->
    <ContainerUIElement3D MouseDown="ContainerMouseDown">
                    <AxisAngleRotation3D x:Name="containerRotation" Axis="0, 1, 0" Angle="0" />

        <!-- Cube 1 -->
        <ModelUIElement3D MouseDown="Cube1MouseDown">
                <TranslateTransform3D OffsetZ="1.5" />

                <GeometryModel3D Geometry="{StaticResource CubeMesh}">
                        <DiffuseMaterial x:Name="cube1Material" Brush="Blue" />

        <!-- Cube 2 -->
        <ModelUIElement3D MouseDown="Cube2MouseDown">
                <TranslateTransform3D OffsetZ="-1.5" />

                <GeometryModel3D Geometry="{StaticResource CubeMesh}">
                        <DiffuseMaterial x:Name="cube2Material" Brush="Green" />

    <!-- Lights -->
            <PointLight Color="White" Position="3, 10, 4" />

The cubes respond to the mouse down event through the following event handlers:

For the complete sample, see Handling Events in 3-D Sample.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5 SP1, 3.0 SP1

Community Additions

© 2015 Microsoft