Viewport2DVisual3D.IsVisualHostMaterial Attached Property


Gets or sets a value that specifies whether a material should be interactive.

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

See GetIsVisualHostMaterial, SetIsVisualHostMaterial

Property Value

Type: System.Boolean

true if the material should be interactive; otherwise, false. The default is false.

You must set the IsVisualHostMaterial attached property on the material on which you wish to have the 2-D visual placed.

IsVisualHostMaterial is introduced in the .NET Framework version 3.5.

Identifier field


Metadata properties set to true


The following example shows how to specify the material where the 2-D visual (the button) should be placed by setting the Material property and also setting the IsVisualHostMaterial attached property to true:

        <PerspectiveCamera Position="0, 0, 4"/>

    <!-- Button on 3D -->
        <!-- Give the plane a slight rotation -->
                    <AxisAngleRotation3D Angle="40" Axis="0, 1, 0" />

        <!-- The Geometry, Material, and Visual for the Viewport2DVisual3D -->
            <MeshGeometry3D Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0"
                            TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/>

            <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>

        <Button>Hello, 3D</Button>

    <!-- Lights -->
            <DirectionalLight Color="#FFFFFFFF" Direction="0,0,-1"/>

For the complete sample, see Interactive 2-D on 3-D Sample.

Return to top