Have a look at the simple example shown here:
http://wpftutorial.net/IntroductionTo3D.html[
^]
And as GanesanSenthilvel recommended if you work with 3d you "Need" something to create your models... Your "I wan't to do it in code" makes you look a little "dumb" - take the example form the link I provided. If you can't convert that xaml to code (but why?), you shouldn't go for 3d WPF... sorry to say that.