正在寻找 WPF 中的最佳数据模板知识及其中使用的属性?
我想要有关使用 C#.NET 在 WPF 中自定义控件(如组合框、列表框等)的数据模板的简要知识。因此,如果有人有任何链接或示例应用程序,请与我分享..
更新: 我了解了 DataTemplate 的一些内容,但现在我想了解 DataTemplate 使用的术语,如 ObservableCollection、DataContext 以及如何根据用户的需要设置 Binding 属性。我想要一个开发非常相似的示例应用程序的想法,例如将组合框的每个项目分为三列,并动态在不同列上添加不同的内容,
提前致谢
I want brief knowledge about Data Template for Customizing a control(like Combo Box,List Box etc.)in WPF using C#.NET. So if anybody have any links or sample applications then share it with me please..
Update:
I got to know the DataTemplate in some what but now I want to know about the terms used for DataTemplate like ObservableCollection,DataContext and how to set the Binding property according to the User's need. I want an idea for develop a very similar kind of Sample application like dividing Combo Box's each items into three Column and adding different contents on different columns dynamically
Thanks in Advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它的使用非常简单 - 但基本上 DataTemplate 允许您使用 XAML 表示数据
here is it used very simply - but basically a DataTemplate allows you to represent data using XAML
您应该查看 WPF 测验演示:http://community.infragistics.com/ Pixel8/media/p/91950.aspx 它将一次性教您 MVVM 和 DataTemplates 的强大功能:)
You should check out the WPF Quiz demo : http://community.infragistics.com/pixel8/media/p/91950.aspx It will teach you MVVM and the power of DataTemplates in one go :)
假设您想在 ComboBox 的每个项目中显示按钮,那么您可以通过重写其 ItemTemplate 方法
和后面的代码
来实现此目的,所以现在当您运行此命令时,您将获得所需的输出,每个组合项目将是一个按钮
Suppose you want to show the button in each item of ComboBox , so you can do this by overriding its ItemTemplate method
and in the code behind
so now when you run this , you will get the desired output , each combo item will be a button