Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.8 KB

how-to-apply-a-drawing-to-a-3-d-model.md

File metadata and controls

32 lines (23 loc) · 1.8 KB
title description ms.date helpviewer_keywords ms.assetid
How to: Apply a Drawing to a 3D Model
Learn how to use a DrawingBrush as the Material applied to a 3D model in Windows Presentation Foundation (WPF).
03/30/2017
drawings [WPF], applying to 3D models
3D models [WPF], applying drawings to
68357577-b7fc-446e-8be9-a8cc7df3a350

How to: Apply a Drawing to a 3D Model

This example shows how to use a xref:System.Windows.Media.DrawingBrush as the xref:System.Windows.Media.Media3D.Material applied to a 3D model.

The following code defines a xref:System.Windows.Media.DrawingGroup as the content of a xref:System.Windows.Media.DrawingBrush. The xref:System.Windows.Media.DrawingBrush is set as the xref:System.Windows.Media.Media3D.DiffuseMaterial.Brush%2A property of the xref:System.Windows.Media.Media3D.DiffuseMaterial applied to a 3D plane.

Note

It is often desirable to define complex objects and values like the drawing below as resources which can be reused and simplify your code. See XAML Resources for more information.

[!code-xaml3DGallery_snip#ApplyDrawingToMaterialInline1]

Example

The following code shows the entire sample.

[!code-xaml3DGallery_snip#ApplyDrawingToMaterialExampleWholePage]

See also