有没有像 ItemsControl 这样的东西可以在 Viewport3D 中使用?
我有一个 Viewport3D,其中有一些项目,我想向其中添加来自可以绑定数据的集合的其他项目。有没有类似的东西,可以允许这样的代码:
<Viewport3D>
<Viewport3D.Camera...>
<ModelVisual3D>
<ModelVisual3D.Content>
<AmbientLight Color="White"/>
</ModelVisual3D.Content>
</ModelVisual3D>
<ItemsControl ItemsSource="{Binding MyCollection}">
<ItemsControl.ItemTemplate>
<DataTemplate ...>
<ModelVisual3D ....>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Viewport3D>
I have a Viewport3D with a few items in it, and I want to add additional items to it that are from a collection that can be data bound to. Is there something like that, that would allow code like this:
<Viewport3D>
<Viewport3D.Camera...>
<ModelVisual3D>
<ModelVisual3D.Content>
<AmbientLight Color="White"/>
</ModelVisual3D.Content>
</ModelVisual3D>
<ItemsControl ItemsSource="{Binding MyCollection}">
<ItemsControl.ItemTemplate>
<DataTemplate ...>
<ModelVisual3D ....>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Viewport3D>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Josh smith 使用 viewport3d 来托管图像列表... http://joshsmithonwpf.wordpress.com/2008/03/30/animating-images-in-a-3d-itemscontrol/
这是您想要的吗?
Josh smith used viewport3d to host a list of images.... http://joshsmithonwpf.wordpress.com/2008/03/30/animating-images-in-a-3d-itemscontrol/
Is this what you seek?
我对此的解决方案是使用标准项目,并在彼此之间进行堆栈viewPort3D控件。这并不尊重深度订购,但是就我而言,我希望项目中的项目无论如何都位于其余元素面前:
My solution to this was to use a standard itemscontrol, and stack Viewport3D controls on top of each other. This doesn't respect depth-ordering, but in my case I wanted the items in the itemscontrol to be in front of the rest of the elements anyways: