为什么它不显示我在 DataTable 中分配的 DataGrid 中的值?

Why doesn't it show me the values in my DataGrid that I assign in the DataTable?

我最初在我的 DataGrid 中手动编写了 headers,现在我想从 DataTable 中填充 DataGrid。我想这样做:

void fillingDataGrid()
    {
        DataTable dt = new DataTable();
        DataColumn id = new DataColumn("id", typeof(int));
        DataColumn name = new DataColumn("name", typeof(string));
        DataColumn ort = new DataColumn("ort", typeof(string));
        DataColumn alter = new DataColumn("alter", typeof(string));
        DataColumn land = new DataColumn("land", typeof(string));

        dt.Columns.Add(id);
        dt.Columns.Add(name);
        dt.Columns.Add(ort);
        dt.Columns.Add(alter);
        dt.Columns.Add(land);

        DataRow firstrow = dt.NewRow();
        firstrow[0] = 1;
        firstrow[1] = "Peter";
        firstrow[2] = "Berlin";
        firstrow[3] = "18";
        firstrow[4] = "Germany";

        DataRow secondrow = dt.NewRow();
        firstrow[0] = 2;
        firstrow[1] = "Karl";
        firstrow[2] = "Prag";
        firstrow[3] = "12";
        firstrow[4] = "Tschechien";

        dt.Rows.Add(firstrow);
        dt.Rows.Add(secondrow);

        gridd.ItemsSource = dt.DefaultView;
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        this.fillingDataGrid();
    }

然而,问题是,如果我这样做,它不会正确输出,因为它看起来像这样:

为什么它不显示所有数据,我必须在我的 DataTable 上更改什么?

更改此行:

gridd.ItemsSource = dt.DefaultView;

收件人:

gridd.DataContext = dt.DefaultView;