There may be a better way to handle this. but here is one way.
You can use the DrawCellEvent, and draw this cell yourself. In your code, you would need to check for any childrows for the node, and draw the cell if there are none. One technical problem is that the childrows are not known until the node is expanded. To handle this, you can do a 'blind' expand using BeginUpdate/EndUpdate. Here is a try at this.
private void gridDataBoundGrid1_DrawCell(object sender, GridDrawCellEventArgs e)
{
if( e.ColIndex == 1)
{
GridBoundRecordState state = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(e.RowIndex);
if( state.HasChildList && state.ChildCount == 0)
{
int count;
if (state.Position >= state.Table.Count)
{
count = 0; //addnew row
}
else
{
this.gridDataBoundGrid1.BeginUpdate();
this.gridDataBoundGrid1.Model.SuspendChangeEvents();
this.gridDataBoundGrid1.ExpandAtRowIndex(e.RowIndex);
count = state.ChildCount ;
this.gridDataBoundGrid1.CollapseAtRowIndex(e.RowIndex);
this.gridDataBoundGrid1.Model.ResumeChangeEvents();
this.gridDataBoundGrid1.EndUpdate();
}
if(count == 0)
{
using(SolidBrush brush = new SolidBrush(e.Style.BackColor))
{
e.Graphics.FillRectangle(brush, e.Bounds);
e.Cancel = true;
}
}
}
}
}