The current situation is that I have this
dataGrid1.ItemsSource = dt.DefaultView;
datagridajuste();
The problem is that when I fill in my "datagrid" (no datagridview), this generates empty tables at the beginning and at the end. So what I was looking for was to put the columns with the datagrid.Columns.add () but I never get it to work with the dt.
Also I would like to know if anyone knows how I can do so that once the datagrid is full and with a size set from the beginning, the contents of the datagrid are adjusted to the size of the datagrid (I have tried with the
dataGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.Fill)
but directly I do not recognize the functions).
I have searched for datagrid information but everything I find is too outdated or does not specify the functions that you have to import and I can not use it.