This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

Windows Presentation Foundation
.NET 4.0+


The second part of the Windows Presentation Foundation Fundamentals tutorial looks at the Extensible Application Markup Language (XAML), providing some samples of its use. This is the XML-based language that is used to create WPF user interfaces.


For our last example we'll look at a completely new XAML document. WPF and XAML allow you to create two-dimensional vector graphics and three-dimensional scenes containing object meshes with materials, lighting and camera positions. The final XAML document displays a three-dimensional, square-based pyramid. Note the mesh, which is created from points in space that are connected using triangles. Note also the positioning and orientation of the camera and spotlight controls.

<Page xmlns=""
         <PerspectiveCamera LookDirection="40,-5,-20" Position="-50,10,40"
                     <MeshGeometry3D Positions="0,0,0 0,0,10 10,0,10 10,0,0 5,10,5"
                                     TriangleIndices="0,2,1 3,2,0 0,1,4 1,2,4 2,3,4 3,0,4"/>
                     <DiffuseMaterial Brush="Orange"/>
               <SpotLight Color="White" Direction="30,0,-100" Position="-100,180,180"/>

When rendered in Kaxaml you should see the following image. Try adjusting the values for the camera slightly to change the view.

XAML 3D Pyramid

NB: In this tutorial we won't look at 3D graphics. They are a complex topic worthy of a separate, future tutorial.

30 January 2013