private static void Bind(SurfacePlotVisual3D target, DependencyProperty targetProperty, object source, string sourcePath) { var b = new Binding(); b.Source = source; b.Path = new PropertyPath(sourcePath); BindingOperations.SetBinding(target, targetProperty, b); }
public void AddSurface(Surface3dViewModel surface) { surface.UpdateSurface(); var plot = new SurfacePlotVisual3D(); Bind(plot, SurfacePlotVisual3D.PointsProperty, surface, "Data"); Bind(plot, SurfacePlotVisual3D.ColorValuesProperty, surface, "ColorValues"); Bind(plot, SurfacePlotVisual3D.SurfaceBrushProperty, surface, "SurfaceBrush"); View3d.Children.Add(plot); }