两组显示在列表视图中单列 [英] display single column in list view with two groups
本文介绍了两组显示在列表视图中单列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有customer表与列
i have customer table have columns with
customer id
customer name
我有另一个表称为地址 addressid addresstext
I have another table called address addressid addresstext
现在我要显示的客户名称和addresstext这样
now i want to display the customer name and addresstext like this
customers
-----------
customer name 1
customer name 2
customer name 3
addresses
-----------
addresstext 1
addresstext 2
addresstext 3
像上图这样的列表视图中唯一的单柱
like this in list view only single column above figure
会在这任何一个请帮助..
would any one pls help on this..
我正在使用的WinForms应用C#
I am using c# in winforms applications
推荐答案
非常感谢您的支持,我已经解决了我的问题........这样
Many Thanks For all your support and i have solved my problem ........like this
lstviewcategories.View = View.Details;
lstviewcategories.Columns.Add(new ColumnHeader() { Width = lstviewcategories.Width - 20 });
lstviewcategories.HeaderStyle = ColumnHeaderStyle.None;
lstviewcategories.Sorting = SortOrder.Ascending;
lstviewcategories.Dock = DockStyle.None;
ListViewGroup categorygroup = new ListViewGroup("Category Types",HorizontalAlignment.Center);
lstviewcategories.Groups.Add(categorygroup);
var categorytypes = (from categories in abc.categories
select categories.category_Name).ToList();
lstviewcategories.Items.Add(new ListViewItem() { Text = "ALL", Group = categorygroup });
foreach (string item in categorytypes)
{
lstviewcategories.Items.Add(new ListViewItem() { Text = item.ToString(), Group = categorygroup });
}
ListViewGroup pricerangegroup = new ListViewGroup("Price Ranges", HorizontalAlignment.Center);
lstviewcategories.Groups.Add(pricerangegroup);
lstviewcategories.Items.Add(new ListViewItem() { Text = "ALL", Group = pricerangegroup });
lstviewcategories.Items.Add(new ListViewItem() { Text = "0-500", Group = pricerangegroup });
lstviewcategories.Items.Add(new ListViewItem() { Text = "500-1000", Group = pricerangegroup });
lstviewcategories.Items.Add(new ListViewItem() { Text = "1000+", Group = pricera
这篇关于两组显示在列表视图中单列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文