C# CSv to wpf code example
Example 1: Read csv file into wpf C#
public MainWindow()
{
InitializeComponent();
ListViewPeople.ItemsSource = ReadCSV("example");
}
Example 2: Read csv file into wpf C#
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int ID { get; set; }
public string Email { get; set; }
public Person(string firstName, string lastName, int id, string email)
{
FirstName = firstName;
LastName = lastName;
ID = id;
Email = email;
}
}
Example 3: Read csv file into wpf C#
<ListView x:Name="ListViewPeople">
<ListView.View>
<GridView>
<GridViewColumn Header="First name" Width="100" DisplayMemberBinding="{Binding Path=FirstName}"/>
<GridViewColumn Header="Last name" Width="150" DisplayMemberBinding="{Binding Path=LastName}"/>
<GridViewColumn Header="ID" Width="40" DisplayMemberBinding="{Binding Path=ID}"/>
<GridViewColumn Header="Email" Width="200" DisplayMemberBinding="{Binding Path=Email}"/>
</GridView>
</ListView.View>
</ListView>