Triangulation Resources

You can't derive a class from MeshGeometry3D, but all is not lost. Instead, you can define a mesh-generation class to be used as a resource in XAML files, and then refer to that resource in your markup with a data binding.

Resource Mechanics

Here's a mesh-generation class that doesn't explicitly inherit from anything:

namespace MyMeshGeometryLibrary
{
    public class SphereMeshGenerator
    {
        ...
        public MeshGeometry3D Geometry
        {
            get { ... }
        }
        ...
    }
}

This SphereMeshGenerator class probably has several properties named Slices, Stacks, Radius, and Center, but it also has a get-only property of type MeshGeometry3D that I've named Geometry. The get-accessor of this Geometry property creates a new MeshGeometry3D, fills all four collections, ...

Get 3D Programming for Windows® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.