DataGrid and DataTable: why is there an extra column

Mar 10, 2009 at 6:57 PM
Dear DataGrid experts:

I created a very simple 2-column datatable and tried to use datagrid to display it:
dataGrid.ItemsSource = table.DefaultView;

The problem is that there is a third blank column showing up. I traced both datatable and datagrid's Columns.Count, and they both are 2.
I just cannot understand why the third column is showing up.

Could anyone help?

Mar 11, 2009 at 5:11 PM
Are you speaking about the filler column to the right which takes over the remaining space? If yes, then that is by design. If you want to get rid of it, you will have to retemplate DataGridColumnHeadersPresenter.
Mar 12, 2009 at 1:40 PM
Yes, the filler column to the right that takes over all the remaining space. I will look into DataGridColumnHeaderPresenter.
Thanks. Alex