如何编写包含图像、文本和按钮的ListViewItem?
我需要编写一些 listViewItem (使用 WPF ) - 其中包含图像、文本和按钮。
我想继承简单的 listViewItem 类并添加到包含三个项目(图像、文本、按钮)的列表视图项目。
我不明白 listView 控件如何在控件中以正确的顺序排列 3 个项目(图像、文本、按钮) - 如何告诉 listview 控件图像是第一个,文本是第二个,按钮是第三个?
I need to write some listViewItem ( using WPF ) - that contain image, text and button.
I want to inherit from the simple listViewItem class and add to the listview item that contain the three items ( image, text, button ).
I don't understand how the listView control will arrange the 3 items ( image , text, button ) in the right order in the control - how to tell the listview control that the image is first, text is second and the button is the third ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先阅读有关布局控件的更多信息。像 StackPanel 和 Grid - 这样您就可以了解如何排列项目。然后阅读模板。
这里给出了与您的任务非常相似的任务的解决方案: http://www.codewrecks.com/blog/index.php/2008/03/26/first-steps-on-wpf-listview- with-template-based-on-data/
First read more about Layout controls. like StackPanel and Grid - so you can understans how to arrange items.Then read about templates.
Solution for a task which is very similar to yours is given here: http://www.codewrecks.com/blog/index.php/2008/03/26/first-steps-on-wpf-listview-with-template-based-on-data/