How can I display the row numbers in XamDataGrid. In UltraWinGrid there used to be a property called RowSelectorNumberStyle to do this. What's the equivalent for XamDataGrid?
Hello,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. So I have been looking through you post and I suggest you use the following style:
<Style TargetType="{x:Type igDP:RecordSelector}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Label Content="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Record.Index}"/> </ControlTemplate> </Setter.Value> </Setter> </Style>
In order to get the look you want.
Feel free to write me if you have further questions.
Thanks for your reply.
The solution you suggested works fine in most cases, but in our case, we have the Record fixing enabled. When I override the record selector style as you suggested, I also lose the record fixer symbols.
Is there a way we can have both, the row number as well as record fixer symbol?
Thanks,
Mihir.
Hello Mihir,
Thank you for your feedback. I created a sample project for you in which I copied the default style for the RecordSelector and made some changes to it, so that now it has the functionality you want. In the future when you want to change the look of some control without losing any of the functionality we provide I suggest you do so. You can find the default styles here: C:\Program Files (x86)\Infragistics\NetAdvantage 2011.1\WPF\DefaultStyles\DataPresenter\DataPresenterGeneric_Express.xaml (for XamDataGrid e.g.).
I found this solution and tried it. It works but only for a limited number of use-cases. For instance, when the grid columns get sorted, or grouped, or if rows are deleted, or rows are added or moved via drag 'n drop, the row numbers do not get updated. For instance, after sorting, the line numbers are no longer sequential. After grouping, they always start afresh from 0 in each sub-group.
Do you think there is a good all-around solution that would work in all these cases? I.e., no matter what the user does to the grid, any of the operations listed above (plus any that I might have forgotten), then a re-numbering must always occur: grid numbering must always start at 1, cascading through groups, with no row-number being repeated. That would be a total solution, and we need that.
Somehow you would have to key off certain events and, in the case of Drag 'n Drop, a notification being raised on the underlying ObservableCollection in the View-Model (meaning that I've updated my collection!).
Thanks in advance!
Hello Majestikm,
In NetAdvantage version 14.1 we have introduced Record numbering. Here you can find more inforamtaion about this feature:
http://help.infragistics.com/Help/Doc/WPF/2014.1/CLR4.0/html/xamDataGrid_Record_Numbering.html