ModelVisual3D Class
TOC
Collapse the table of content
Expand the table of content

ModelVisual3D Class

 

Provides a Visual3D that renders Model3D objects.

Namespace:   System.Windows.Media.Media3D
Assembly:  PresentationCore (in PresentationCore.dll)

System.Object
  System.Windows.Threading.DispatcherObject
    System.Windows.DependencyObject
      System.Windows.Media.Media3D.Visual3D
        System.Windows.Media.Media3D.ModelVisual3D

[ContentPropertyAttribute("Children")]
public class ModelVisual3D : Visual3D, IAddChild

NameDescription
System_CAPS_pubmethodModelVisual3D()

Initializes a new instance of the ModelVisual3D class.

NameDescription
System_CAPS_pubpropertyChildren

Gets a collection of child Visual3D objects.

System_CAPS_pubpropertyContent

Gets or sets the model that comprises the content of the ModelVisual3D.

System_CAPS_pubpropertyDependencyObjectType

Gets the DependencyObjectType that wraps the CLR type of this instance. (Inherited from DependencyObject.)

System_CAPS_pubpropertyDispatcher

Gets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.)

System_CAPS_pubpropertyHasAnimatedProperties

Gets a value that indicates whether this Visual3D has any animated properties.(Inherited from Visual3D.)

System_CAPS_pubpropertyIsSealed

Gets a value that indicates whether this instance is currently sealed (read-only).(Inherited from DependencyObject.)

System_CAPS_pubpropertyTransform

Gets or sets the transform set on the ModelVisual3D.

System_CAPS_protpropertyVisual3DChildrenCount

Returns the number of child objects.(Overrides Visual3D.Visual3DChildrenCount.)

System_CAPS_protpropertyVisual3DModel

Gets or sets the Model3D object to render.(Inherited from Visual3D.)

NameDescription
System_CAPS_protmethodAddVisual3DChild(Visual3D)

Defines the parent-child relationship between two 3-D visuals.(Inherited from Visual3D.)

System_CAPS_pubmethodApplyAnimationClock(DependencyProperty, AnimationClock)

Applies the effect of a given AnimationClock to a given dependency property.(Inherited from Visual3D.)

System_CAPS_pubmethodApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)

Applies the effect of a given AnimationClock to a given dependency property. The effect of the new AnimationClock on any current animations is determined by the value of the handoffBehavior parameter.(Inherited from Visual3D.)

System_CAPS_pubmethodBeginAnimation(DependencyProperty, AnimationTimeline)

Initiates an animation sequence for the DependencyProperty object, based on the specified AnimationTimeline.(Inherited from Visual3D.)

System_CAPS_pubmethodBeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)

Initiates an animation sequence for the DependencyProperty object, based on both the specified AnimationTimeline and HandoffBehavior.(Inherited from Visual3D.)

System_CAPS_pubmethodCheckAccess()

Determines whether the calling thread has access to this DispatcherObject.(Inherited from DispatcherObject.)

System_CAPS_pubmethodClearValue(DependencyProperty)

Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier. (Inherited from DependencyObject.)

System_CAPS_pubmethodClearValue(DependencyPropertyKey)

Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey. (Inherited from DependencyObject.)

System_CAPS_pubmethodCoerceValue(DependencyProperty)

Coerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.(Inherited from DependencyObject.)

System_CAPS_pubmethodEquals(Object)

Determines whether a provided DependencyObject is equivalent to the current DependencyObject.(Inherited from DependencyObject.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodFindCommonVisualAncestor(DependencyObject)

Returns the common ancestor of the visual object and another specified visual object.(Inherited from Visual3D.)

System_CAPS_pubmethodGetAnimationBaseValue(DependencyProperty)

Retrieves the base value of the specified DependencyProperty object.(Inherited from Visual3D.)

System_CAPS_pubmethodGetHashCode()

Gets a hash code for this DependencyObject.(Inherited from DependencyObject.)

System_CAPS_pubmethodGetLocalValueEnumerator()

Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject. (Inherited from DependencyObject.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodGetValue(DependencyProperty)

Returns the current effective value of a dependency property on this instance of a DependencyObject. (Inherited from DependencyObject.)

System_CAPS_protmethodGetVisual3DChild(Int32)

Returns the specified Visual3D in the parent collection.(Overrides Visual3D.GetVisual3DChild(Int32).)

System_CAPS_pubmethodInvalidateProperty(DependencyProperty)

Re-evaluates the effective value for the specified dependency property(Inherited from DependencyObject.)

System_CAPS_pubmethodIsAncestorOf(DependencyObject)

Determines whether the visual object is an ancestor of the descendant visual object.(Inherited from Visual3D.)

System_CAPS_pubmethodIsDescendantOf(DependencyObject)

Determines whether the visual object is a descendant of the ancestor visual object. (Inherited from Visual3D.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnPropertyChanged(DependencyPropertyChangedEventArgs)

Invoked whenever the effective value of any dependency property on this DependencyObject has been updated. The specific dependency property that changed is reported in the event data. (Inherited from DependencyObject.)

System_CAPS_protmethodOnVisualChildrenChanged(DependencyObject, DependencyObject)

Called when the Visual3DCollection of the visual object is modified.(Inherited from Visual3D.)

System_CAPS_protmethodOnVisualParentChanged(DependencyObject)

Called when the parent of the 3-D visual object is changed.(Inherited from Visual3D.)

System_CAPS_pubmethodReadLocalValue(DependencyProperty)

Returns the local value of a dependency property, if it exists. (Inherited from DependencyObject.)

System_CAPS_protmethodRemoveVisual3DChild(Visual3D)

Removes the parent-child relationship between two 3-D visuals.(Inherited from Visual3D.)

System_CAPS_pubmethodSetCurrentValue(DependencyProperty, Object)

Sets the value of a dependency property without changing its value source. (Inherited from DependencyObject.)

System_CAPS_pubmethodSetValue(DependencyProperty, Object)

Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.)

System_CAPS_pubmethodSetValue(DependencyPropertyKey, Object)

Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property. (Inherited from DependencyObject.)

System_CAPS_protmethodShouldSerializeProperty(DependencyProperty)

Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.(Inherited from DependencyObject.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodTransformToAncestor(Visual)

Returns a transform that can be used to transform coordinates from this Visual3D object to the specified Visual ancestor of the object.(Inherited from Visual3D.)

System_CAPS_pubmethodTransformToAncestor(Visual3D)

Returns a transform that can be used to transform coordinates from this Visual3D object to the specified Visual3D ancestor of the object.(Inherited from Visual3D.)

System_CAPS_pubmethodTransformToDescendant(Visual3D)

Returns a transform that can be used to transform coordinates from this Visual3D object to the specified Visual3Ddescent object.(Inherited from Visual3D.)

System_CAPS_pubmethodVerifyAccess()

Enforces that the calling thread has access to this DispatcherObject.(Inherited from DispatcherObject.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticContentProperty

Identifies the Content dependency property.

System_CAPS_pubfieldSystem_CAPS_staticTransformProperty

Identifies the Transform dependency property.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIAddChild.AddChild(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. Adds a child object.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIAddChild.AddText(String)

This API supports the product infrastructure and is not intended to be used directly from your code. Adds the text content of a node to the object.

Provides services and properties that are common to all visual objects, including hit-testing, coordinate transformation, and bounding-box calculations.

The ModelVisual3D class has a Children property that enables you to build a tree structure of ModelVisual3D objects.

ModelVisual3D objects are optimized as scene nodes. For example, they cache bounds. Whenever you can, use ModelVisual3D objects for unique instances of objects within your scene. This usage contrasts with that of Model3D objects, which are lightweight objects that are optimized to be shared and reused. For example, use a Model3D object to build a model of a car; and use ten ModelVisual3D objects to place ten cars in your scene.

The following example shows an instance of ModelVisual3D in markup. myTeapot refers to a MeshGeometry3D defined externally. You can substitute any geometry of your own.

<DockPanel>
  <Viewport3D Name="myViewport">

    <Viewport3D.Camera>
      <PerspectiveCamera FarPlaneDistance="20" LookDirection="5,-2,-3" UpDirection="0,1,0" NearPlaneDistance="0" Position="-5,2,3" FieldOfView="45" />
    </Viewport3D.Camera>

    <ModelVisual3D x:Name="topModelVisual3D">
      <ModelVisual3D.Children>
        <ModelVisual3D>
          <ModelVisual3D.Content>
            <DirectionalLight Color="#FFFFFFFF" Direction="-3,-4,-5" />
          </ModelVisual3D.Content>
        </ModelVisual3D>

        <ModelVisual3D>
          <ModelVisual3D.Content>
            <GeometryModel3D Geometry="{StaticResource myTeapot}">
              <GeometryModel3D.Material>
                <DiffuseMaterial>
                  <DiffuseMaterial.Brush>
                    <SolidColorBrush Color="Blue" Opacity="1.0" />
                  </DiffuseMaterial.Brush>
                </DiffuseMaterial>
              </GeometryModel3D.Material>
              <GeometryModel3D.Transform>
                <RotateTransform3D>
                  <RotateTransform3D.Rotation>
                    <AxisAngleRotation3D x:Name="myAngleRotation" Axis="0,3,0" Angle="1" />
                  </RotateTransform3D.Rotation>
                </RotateTransform3D>
              </GeometryModel3D.Transform>
            </GeometryModel3D>
          </ModelVisual3D.Content>
        </ModelVisual3D>


      </ModelVisual3D.Children>
    </ModelVisual3D>


    <Viewport3D.Triggers>

      <EventTrigger RoutedEvent="Viewport3D.Loaded">
        <BeginStoryboard>
          <Storyboard>
            <DoubleAnimation 
              Storyboard.TargetName="myAngleRotation"
              Storyboard.TargetProperty="Angle"
              From="0" To="360" Duration="0:0:10"
              RepeatBehavior="Forever" />
          </Storyboard>
        </BeginStoryboard>
      </EventTrigger>
    </Viewport3D.Triggers>


  </Viewport3D>
</DockPanel>

.NET Framework
Available since 3.0

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

Return to top
Show:
© 2016 Microsoft