**How to: Fill a DataGrid.DataContext with information from txt files (C#, WPF)**

I am trying to fill my `DataGrid` with information I get from some txt files. There is a folder called "CONTACTS" and there are some (5) files in. These files are configurated this way:

Content of **John Doe.txt** (without list symbols):

* John Doe Corp.
* Mr.
* Doe
* John

**XAML:**

```
<DataGrid AutoGenerateColumns="False" CanUserResizeRows="False" DockPanel.Dock="Bottom" ItemsSource="{Binding CollectionofDetails}" Name="dataGrid_Content">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding CorporationName}" Header="Firma" />
                    <DataGridTextColumn Binding="{Binding Prefix}" Header="Anrede" />
                    <DataGridTextColumn Binding="{Binding FirstName}" Header="Nachname" />
                    <DataGridTextColumn Binding="{Binding LastName}" Header="Vorname" />
                </DataGrid.Columns>
            </DataGrid>

```

**C#:**

```
public class Details
    {
        public string CorporationName { get; set; }
        public string Prefix { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }

    public ObservableCollection<Details> _CollectionofDetails = new ObservableCollection<Details>();

    public ObservableCollection<Details> CollectionofDetails
    {
        get { return _CollectionofDetails; }
        set { _CollectionofDetails = value; }
    }

    public void SetItemsToDataContext()
    {
        foreach (string Datei in Directory.GetFiles(@"C:\Users\schwarz\Desktop\Cusposes_2014-05-20_0827\ISAPO\ISAPO Cusposes\Business Contacts\Contacts", "*.txt"))
        {
            StreamReader reader = new StreamReader(Datei);

            int i = 0;
            string line = reader.ReadToEnd().Replace("\n", "");
            string[] t = line.Split('\r');
            Details d = new Details();
            d.CorporationName = t[i];
            d.Prefix = t[i + 1];
            d.FirstName = t[i + 2];
            d.LastName = t[i + 3];

            CollectionofDetails.Add(d);
            reader.Close();
        }
    }

```

**Unfortunately, I do have the following problems:**

1. I do not know how to load THE CONTENT of each file (for all files).
2. I do not know how to fill my `DataGrid` with this Information.

**--> Solution by Dhaval Patel (see below).**