D
David Elliott
I am trapping the MouseDown event and am looking to get the value of the cell
and also the Column name.
I can get the value of the cell with the code below. I can also get the Column name
if the DataGrid has a TableStyle. The problem comes when the DataGrid uses the
default TableStyle.
Using the debugger I walked down the class structure and could find the information
at this point
dataGrid1.Controls[hti.Column].dataGrid.defaultTableStyle.gridColumns.List._items
I can't seem to find my way there at design time, programmatically.
Any help would be appreciated.
Dave
(e-mail address removed)
=======================================================
if (e.Button == MouseButtons.Right)
{
DataGridTableStyle ts1;
gridBoxText = "";
if (hti.Type == DataGrid.HitTestType.Cell)
{
gridBoxText = dataGrid1[hti.Row, hti.Column].ToString();
ts1 = dataGrid1.TableStyles["JobRecordCollection"];
if (ts1 != null)
gridHdrText = ts1.GridColumnStyles[hti.Column].HeaderText;
else
gridHdrText = dataGrid1.Controls[hti.Column].Text;
}
else if (hti.Type == DataGrid.HitTestType.ColumnHeader)
{
gridHdrText = dataGrid1.Controls[hti.Column].Text;
}
}
}
and also the Column name.
I can get the value of the cell with the code below. I can also get the Column name
if the DataGrid has a TableStyle. The problem comes when the DataGrid uses the
default TableStyle.
Using the debugger I walked down the class structure and could find the information
at this point
dataGrid1.Controls[hti.Column].dataGrid.defaultTableStyle.gridColumns.List._items
I can't seem to find my way there at design time, programmatically.
Any help would be appreciated.
Dave
(e-mail address removed)
=======================================================
if (e.Button == MouseButtons.Right)
{
DataGridTableStyle ts1;
gridBoxText = "";
if (hti.Type == DataGrid.HitTestType.Cell)
{
gridBoxText = dataGrid1[hti.Row, hti.Column].ToString();
ts1 = dataGrid1.TableStyles["JobRecordCollection"];
if (ts1 != null)
gridHdrText = ts1.GridColumnStyles[hti.Column].HeaderText;
else
gridHdrText = dataGrid1.Controls[hti.Column].Text;
}
else if (hti.Type == DataGrid.HitTestType.ColumnHeader)
{
gridHdrText = dataGrid1.Controls[hti.Column].Text;
}
}
}