0

Simple sample to make objects in code

Anonymous 10 years ago 0
This discussion was imported from CodePlex

mentalarray wrote at 2012-03-27 03:13:

Hi well done for such a great project...

I just wondred whethr there is a sample to add/make objects from scratch in code, i have seen the Mvvm demo but was interested in another more simpler way

Much thanks...


murray_b wrote at 2012-03-27 05:21:

How simple?

In the MVVM example it creates a observable collection

�public ObservableCollection Objects { get; set; }

Binds it to the itemsource of the Viewport

then adds objects to it in code.  Ie Objects.Add( new #any of the Visual3d objects#)

objects.add (new TubeVisual3D
                           {
                               Path = polygonPoints,
                               Material = MaterialHelper.CreateMaterial(tubeColor),
                               BackMaterial = MaterialHelper.CreateMaterial(tubeColor),
                               Diameter = 0.1
                           });

Does that help? Let me know if that doesn't make sense

or do you want a non-mvvm. If so just add objects in code behind to the itemsource

 

 

 


mentalarray wrote at 2012-03-27 17:20:

Oh brill thanks murray_b just what i needed