Eni*_*ate 5 .net c# grouping listview winforms
我有客户表有列
customer id
customer name
Run Code Online (Sandbox Code Playgroud)
我有另一个名为address addressid addresstext的表
现在我想显示这样的客户名称和地址文本
customers
-----------
customer name 1
customer name 2
customer name 3
addresses
-----------
addresstext 1
addresstext 2
addresstext 3
Run Code Online (Sandbox Code Playgroud)
像这样在列表视图中只有上面的单列
任何人都会对此有所帮助..
我在winforms应用程序中使用c#
非常感谢您的支持,我已经解决了我的问题......就像这样
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 = pricerangegroup });
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3470 次 |
| 最近记录: |