动态数据模板(首选 Silverlight)
是否可以有一个带有数据模板的列表框,该模板会根据 ItemsSource 的某些属性而变化?例如,也许您想要一个包含各种项目(例如图像、视频、自定义面板等)的列表。希望它可以像某种工厂一样运行。
有什么想法吗?
Is it possible to have a ListBox with a Data Template that changes depending on certain properties of the ItemsSource? For instance maybe you want a list with a variety of items such as images, video, custom panels, etc. Was hoping it could behave like some sort of factory.
Any ideas how this would work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 WPF 领域,您可以使用 DataTemplateSelector,不幸的是 Silverlight 中不存在,但有几篇文章,例如 这个,围绕展示如何将类似的东西放在一起。
In WPF land you'd use a DataTemplateSelector, which unfortunately doesn't exist in Silverlight, but there are several articles, like this one, around showing how to put something similar together.