How to set Grid properties?

  • Thread starter Thread starter Brett Romero
  • Start date Start date
B

Brett Romero

I'd like to set certain grid properties generically. Meaning, I have a
method located in an independent class, pass in the particular grid and
have certain properties set. The problem is that I'm not sure how to
get the grid with those set properties back to the calling class. For
example:

DataGridOperation.cs:

public void BindDataGridTableSyle(DataGrid myGrid)
{
myGrid.TableStyles.Clear();
myGrid.TableStyles.Add(gridTableStyle);
}


Form1.cs:

DataGridOperation dgo = new DataGridOperation();
dgo.BindDataGridTableStyle(DataGrid1);
DataGrid1.DataSource = SomeDataTable;

The problem is the properties set in the above method are not coming
through in the grid. Do I need to return myGrid from the method? How
does that work because I'll then have DataGrid1 plus some other method.

Thanks,
Brett
 
In DataGridOperation.cs. I don't see the mapping changes coming
through on the calling form.
 
Actally, the dataset I'm using as a source is empty and not returning
the column I need anyway. I'll adjust this and see what happens.

Thanks,
Brett
 
Actually, regardless of what the dataset returns, shouldn't the table
style take affect on the grid? Or, if a single mapped column is
missing, will that break the table style and it won't come through in
the grid?

Thanks,
Brett
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top