Viewport2DVisual3D.Material 属性

定义

获取或设置描述三维对象外观的材料。

public:
 property System::Windows::Media::Media3D::Material ^ Material { System::Windows::Media::Media3D::Material ^ get(); void set(System::Windows::Media::Media3D::Material ^ value); };
public System.Windows.Media.Media3D.Material Material { get; set; }
member this.Material : System.Windows.Media.Media3D.Material with get, set
Public Property Material As Material

属性值

Material

三维对象的材料。

示例

以下示例演示如何通过设置此属性并将附加属性设置为IsVisualHostMaterialtrue:指定二维视觉对象 (按钮) 放置的材料:

<Viewport3D>
    <Viewport3D.Camera>
        <PerspectiveCamera Position="0, 0, 4"/>
    </Viewport3D.Camera>
    
    <!-- Button on 3D -->
    <Viewport2DVisual3D>
        <!-- Give the plane a slight rotation -->
        <Viewport2DVisual3D.Transform>
            <RotateTransform3D>
                <RotateTransform3D.Rotation>
                    <AxisAngleRotation3D Angle="40" Axis="0, 1, 0" />
                </RotateTransform3D.Rotation>
            </RotateTransform3D>
        </Viewport2DVisual3D.Transform>
        
        <!-- The Geometry, Material, and Visual for the Viewport2DVisual3D -->
        <Viewport2DVisual3D.Geometry>
            <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"/>
        </Viewport2DVisual3D.Geometry>

        <Viewport2DVisual3D.Material>
            <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
        </Viewport2DVisual3D.Material>                               
        
        <Button>Hello, 3D</Button>
    </Viewport2DVisual3D>
    
    <!-- Lights -->
    <ModelVisual3D>
        <ModelVisual3D.Content>
            <DirectionalLight Color="#FFFFFFFF" Direction="0,0,-1"/>
        </ModelVisual3D.Content>
    </ModelVisual3D>
</Viewport3D>

注解

必须在要放置二维视觉对象的材料上设置 IsVisualHostMaterial 附加属性。

Material.NET Framework版本 3.5 中引入。

适用于