user496949
user496949

Reputation: 86085

How to add sequence numbers to row headers

I want to add autogenerated numbers to the row headers. I am wondering if this is doable by using WPF datagrid?

Upvotes: 2

Views: 367

Answers (1)

Fredrik Hedblad
Fredrik Hedblad

Reputation: 84657

You can set them when a DataGridRow is loaded in the LoadingRow event

<DataGrid ...
          LoadingRow="dataGrid_LoadingRow">

private void dataGrid_LoadingRow(object sender, DataGridRowEventArgs e)
{
    e.Row.Header = (e.Row.GetIndex()).ToString();
}

Upvotes: 4

Related Questions