I want to draw a set of 3D-Cubes, each Cube should display a name and also should have its own event handler when the cube is selected.
Is it possible to implement it using code behind or xaml binding?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To draw a 3D cube from code behind I would use the Helix3D toolkit CubeVisual3D. However if you want to stick with stock WPF 3D elements it is fairly simple to implement.
start here to Learn about Text in 3D enviroments http://www.codeproject.com/Articles/33893/WPF-Creation-of-Text-Labels-for-3D-Scene which will guide you through two different approaches to adding Text to a 3D image and I find very helpful.
For a cube Just use a RectangleVisual3D object Something like this.
Too add the event handler I believe you must add the Handler to the Viewport3D. Something of this nature should work.
Then Add this function
Then Add in the Event Handlers