Hi,I have the index of a certain row in a xamDataGrid, and I want to add a visible line above it to mark a boundary between it and the rows above. The line *must* be between the two rows, not within the row, for presentation reasons, which is why setting the background of one of the rows won't work. Kind of like http://community.infragistics.com/forums/t/52311.aspx, but for a WPF xamDataGrid. Currently the only hackish method I've got is to set the background of the row and the row above it such that there seems to be a symmetric line between the two.Neil
Hello,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.
Here is a small sample that does that (Grid_line_between_Records.zip)
Please let me know if you require any further assistance on the matter.
Actually, I had temporarily worked around this by adding gradient stops to the backgrounds of the row above and the row below where the line had to go, successfully creating the illusion of a line. However, this tripled the number of brushes required, which may no longer be practical for me, which is why I posted further details here: http://stackoverflow.com/questions/11437869/creating-a-horizontal-separator-in-xamdatagrid. The solution you propose above is interesting, could you give some more sample code to show how you would use the RecordPresenter to position a line element in the window that would survive resizing?
Hello Neil,
I have been looking into your requirement and the XamDataGrid doesn’t have any such built-in functionality and its visual tree does not have an element between its Records that can be modified. This would leave you with the only option of drawing your own element on the position you like. You can get the visual elements of the DataRecords by using the RecordPresenter class’s FromRecord static method like so:
RecordPresenter.FromRecord(xamDataGrid1.ActiveRecord);
you would only need to consider whether records are in in view when trying to get their visual as relative drawing point. Another thing that comes to mind would be using the RecordsInViewChanged event on order to update the position of your line/splitter element.
Please let me know if I can be of any further assistance on the matter.