I am trying to assign different tooltips to DataGrid rows according to certain conditions.
private void DataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
DataGridRow row = e.Row;
if (row["AssemblySummary"].ToString.Contains("Class"))
{
row.ToolTip = "Class definition...";
}
}
I am getting “Cannot apply indexing to an expression of type ‘System.Windows.Controls.DataGridRow’.” If i have a row why cannot i access its items? How to access cell[i]?
Edit made: I am verry sorry, I needed to access first cell in the given row like it is done now. I still have the same error. Thank you
Try this and let us know if it works:
If it doesn’t, then it could be that the visual row has been loaded, but the data hasn’t been bound yet.