GridView - Rowheader

I figured how to customize the column header.

GridColumn column = new GridColumn();

if (column.ControlObject is Eto.Wpf.Forms.Cells.CustomCellHandler.Column header)
{
    // Add to header whatever control you want  
    // Wpf - Windows only
    AFGridViewHeader _header = new AFGridViewHeader();
    header.Header = _header;
}

I am still having problems to get a rowheader.

Currently I am doing the following. When the Eto.Forms.GridView is constructed I am registering the LoadingRow event for the ControlObject:

if (this.ControlObject is Eto.Wpf.Forms.Controls.EtoDataGrid dataGrid)
{
    dataGrid.RowHeaderWidth = 20;
    dataGrid.LoadingRow += new EventHandler<System.Windows.Controls.DataGridRowEventArgs>(this.OnLoadingRow);
}

And handling the event:

private void OnLoadingRow(object sender, System.Windows.Controls.DataGridRowEventArgs e)
{
    e.Row.Header = (e.Row.GetIndex() + 1).ToString();
}

Nothing is showing up. Any help would be much appreciated.

Kindest
Christian

@curtisw Could you have a look at this if there is any time available.

Kindest
Christian

Hey @Christian_Hartz,

You have to set the DataGrid.HeadersVisibility property, something like this:

if (this.ControlObject is Eto.Wpf.Forms.Controls.EtoDataGrid dataGrid)
{
    dataGrid.RowHeaderWidth = 20;
    dataGrid.HeadersVisibility = System.Windows.Controls.DataGridHeadersVisibility.All;
    dataGrid.LoadingRow += this.OnLoadingRow;
}

Hope this helps!

1 Like

Well that did it.

Thanks a lot
Christian

1 Like

Maybe one more thing to add here. To get the rowheaderwidth set to auto you have to set the double value to double.NaN.

if (this.ControlObject is Eto.Wpf.Forms.Controls.EtoDataGrid dataGrid)
{
    dataGrid.RowHeaderWidth = double.NaN;
    dataGrid.HeadersVisibility = System.Windows.Controls.DataGridHeadersVisibility.All;
    dataGrid.EnableRowVirtualization = true;
    dataGrid.LoadingRow += new EventHandler<System.Windows.Controls.DataGridRowEventArgs>(this.OnLoadingRow);
}

DataGrid.RowHeaderWidth Property