Windows Forms: Metro ListView in C#

Create a Metro ListView using Metro Framework, then use Entity Framework to retrieve data from SQL Database in C#

Step 1Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "MetroListViewDemo" and then click OK

metro listview

Step 2: Right click on your project select Manage NuGet Packages -> Search metro framework -> Install

install metro framework

If you don't see the metro framework in your toolbox, you can view How to download and install metro framework

Step 3: Design your form as below

First, you need to change 

public partial class Form1 : Form

to

public partial class Form1 : MetroFramework.Forms.MetroForm

metro form

Right click on your project select Add -> New Item -> ADO.NET Entity Data Model -> Select Northwind database -> Customers table

If you haven't got Northwind database, you can view How to download and restore Northwind database in SQL Server

Step 4: Add code to handle button click event

private void btnLoad_Click(object sender, EventArgs e)
{
    mListView.Items.Clear();
    using (NorthwindEntities db = new NorthwindEntities())//Create an instance dbcontext
    {
        var list = db.Customers.ToList();//Retrieve data
        foreach (Customer c in list)
        {
            ListViewItem item = new ListViewItem(c.CustomerID);//Add data to MetroListView
            item.SubItems.Add(c.ContactName);
            item.SubItems.Add(c.ContactTitle);
            item.SubItems.Add(c.Address);
            item.SubItems.Add(c.City);
            mListView.Items.Add(item);
        }
    }
}

VIDEO TUTORIALS