Element Flow, Button

May 21, 2010 at 1:48 PM

Hi

Breif: New to WPF and directly jumped over FluidKit. Have started working on a little assignment.
Assignment: Element Flow is the target control. And I want to place a button there. As usual, I've tried with many different ways, but no success so far.

Code:

public void Add2D(int index, ModelUIElement3D model3d)
{
 var geom3D = (model3d.Model as GeometryModel3D).Clone(); 
 MeshGeometry3D geom2d = (geom3D.Geometry as MeshGeometry3D).Clone();

 _Viewport2D.Geometry = geom2d;
 var material = new DiffuseMaterial { Brush = Brushes.White };

 Viewport2DVisual3D.SetIsVisualHostMaterial(material, true);
 _Viewport2D.Material = material;
 _Viewport2D.Transform = new RotateTransform3D
 {
  Rotation = new AxisAngleRotation3D
 {
  Angle = 45,
  Axis = new Vector3D(0, 1, 0)
  }
 };
 _Viewport2D.Visual = new Button { Content = "Testing", Background = Brushes.Aqua };
 _3DModelContainer.Children.Add(_Viewport2D);
}

 

Your comments will be highly appriciated.

Peace, Nav