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
What you have should work. Where is gridTableStyle
defined???
> public void BindDataGridTableSyle(DataGrid myGrid)
> {
> myGrid.TableStyles.Clear();
> myGrid.TableStyles.Add(gridTableStyle);
> }

Signature
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp
> 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
[quoted text clipped - 22 lines]
> Thanks,
> Brett
Brett Romero - 20 Dec 2005 23:32 GMT
In DataGridOperation.cs. I don't see the mapping changes coming
through on the calling form.
Brett Romero - 21 Dec 2005 01:20 GMT
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
Brett Romero - 21 Dec 2005 18:56 GMT
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