Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4025258
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:49:26+00:00 2026-05-20T10:49:26+00:00

So I have a CSV file: Header1,Header2,Header3,Header4 Data11,Data12,Data13,Data14 Data21,Data22,Data23,Data24 Data31,Data32,Data33,Data34 Data41,Data42,Data43,Data44 and a DataGrid

  • 0

So I have a CSV file:

    Header1,Header2,Header3,Header4
    Data11,Data12,Data13,Data14
    Data21,Data22,Data23,Data24
    Data31,Data32,Data33,Data34
    Data41,Data42,Data43,Data44

and a DataGrid in an WPF project. I cannot, for the life of me, get it to import. What I was trying to do before was add all the columns (Header1, Header2, Header3, Header4) then add the rows… but there didn’t seem to be any way to add rows. So I tried using ItemSource… but no luck.

So… how do I import a CSV file into a System.Windows.Controls.DataGrid

UPDATE

So I tried this:

    DataTable table = CSVReader.ReadCSVFile(fileName, true);
    dataGrid.ItemsSource = table.DefaultView;

And it seems to work… somewhat:
The Rows show up, but no columns or content

UPDATE 2

So after turning on AutoGenerateColumns, everything worked perfectly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:49:26+00:00Added an answer on May 20, 2026 at 10:49 am

    Take a look at this library.
    It lets you convert any CSV into an object of type DataTable and bind that to the DataGrid like this:

    DataTable table = CSVReader.ReadCSVFile(fileName, true);
    myGridView.ItemSource = table.DefaultView;
    myGridView.AutoGenerateColumns = true;
    

    If you already have parsed your CSV into a table, just bind the ItemSource to the table’s DefaultView property and set AutoGenerateColums to true

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my CSV file imported as such: records = FasterCSV.read(path, :headers => true,
I have a .csv file that is frequently updated (about 20 to 30 times
I have a CSV file that holds about 200,000 - 300,000 records. Most of
I have a csv file of the format: 270291014011 ED HARDY - TRUE TO
I have a large CSV file and I want to execute a stored procedure
I have a CSV data file with rows that may have lots of columns
I have a CSV of file of data that I can load in R
I have an application that reads a CSV file with piles of data rows.
I have a big string (let's call it a CSV file, though it isn't
I have a Ruby script that generates a UTF8 CSV file remotely in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.