Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Silverlight 3D (WPF 3D Emulation) on C#
2 replies. Latest Post by Toducs on December 8, 2008.
(0)
Toducs
Member
20 points
10 Posts
12-04-2008 5:26 PM |
I just release on codeplex the source code of silverlight 3D engine that we use to create the Column3DSeries for the Silverlight toolkit chart control.
http://www.codeplex.com/aXelerateSL3D
One thing that i can solve on the engine was the use of the FindName to get named elements that are child dependency objects.
For example i have on the xaml a control of type Viewport3D, that is a custom control that has a dependecy property called children that is a ObservableCollection of ModelVisual3D Intances (another custom class that in this case inherit from DependencyObject) and if a set a x:Name to one of the ModelVisual3D elements the FindName method can't find it.
I try to create a especial collection type that is a DependencyObject and implements IList, IEnumerable and ICollection but still the FindName can't reach the ModelVisual3D. Any idea of how to fix it?
Is important to use the FindName of framework element because is the way that use the Storyboards to find the Target by name.
waldred
702 points
113 Posts
12-07-2008 3:56 PM |
FindName should work, and if it doesn't work (for something known to be in the visual tree) you should file a bug.
As a workaround, you could create your own light-weight version that uses the VisualTreeHelper static class to navigate through the visual tree and find the elements you need. But since this is for a 3D engine, I would be very careful and attempt to restrict your visual tree navigation to the absolute bare minimum needed as to not adversely affect performance.
12-08-2008 11:54 AM |
MMmm... Is necesary that the control stay in the Visual Tree? what happen for example with things like the Transformations, that are DepencecyObjects that must be part of the Logical Tree but not the Visual tree?. In my case the problem is with classes like Viewport3D that contains a list of Visual3D elements i can use FindName to find the Vieport or other dependency objects that are single depencyproperties of viewport3D but i can't use to find the Visual3D child elements (i think that is something related with the observablecollection that i am using as dependencyproperty to keep the childs). I try to create a custom collection that inherits from dependencyobject and implements IList, ICollection and IEnumerate but still not luck. At the end i can create a custom findname to use with the viewport but the problem still is that i can't use it to bind the Storyboards on xaml to the tranformation or other property of the child elements of the 3D Engine.