I want to have the option to display row numbers. It seems like it should be pretty easy, looking at this:
https://es.infragistics.com/help/winforms/wingrid-displaying-row-numbers-in-row-selectors
But when I use this code it doesn't work:
Private Sub chkShowRowNumbers_CheckedChanged(sender As Object, e As EventArgs) Handles chkShowRowNumbers.CheckedChanged If chkShowRowNumbers.CheckState = CheckState.Checked Then grdGrid.DisplayLayout.Override.RowSelectorStyle = RowSelectorNumberStyle.RowIndex grdGrid.DisplayLayout.Bands(0).Override.RowSelectorWidth = 100 '-> how do we set this width automatically? Else grdGrid.DisplayLayout.Override.RowSelectorStyle = RowSelectorNumberStyle.None grdGrid.DisplayLayout.Bands(0).Override.RowSelectorWidth = 20 '-> how do we set this width automatically? End If End Sub
Thanks!
Hello Drilon,
I recommend you see the following forum thread:
https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/95215/xamdatagrid-how-to-show-row-numbers
How can i do this thing for XamDataGrid? Thank you
That was the magic I was looking for, thank you!
Hello Ted,
Thank you for contacting Infragistics!
Looking at your code you appear to not be getting row numbers because you are not setting the proper row selector style. You are setting RowSelectorStyle, instead you want to set RowSelectorNumberStyle, for example:
ultraGrid1.DisplayLayout.Override.RowSelectorNumberStyle = RowSelectorNumberStyle.RowIndex