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 |
|
68357577-b7fc-446e-8be9-a8cc7df3a350 |
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]
The following code shows the entire sample.
[!code-xaml3DGallery_snip#ApplyDrawingToMaterialExampleWholePage]