Hi,
I have 2 separate XamDataGrids into the same screen and it is part of the requirement to have them both synched for hovering, is it possible?
how can i achieve this functionality
I am using version 14.2.
Thanks!
Thank you Andrew
Its working fine
Hello Ripal,
There is a different property that controls the background color of the alternately-highlighted records in the DataRecordCellArea. In the data trigger mentioned in my original response, I would recommend that you add a second setter that sets the BackgroundAlternate property of the DataRecordCellArea. This will work to synchronize the hover on the alternately-highlighted rows.
I have attached a modified version of the original sample I sent to demonstrate the above.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Hi Andrew,
Thanks for your reply. i have tried your sample application and its working fine. when i set HighlightAlternateRecords = true then it is not working. in my application i have highlightalternatecolor property to true.
can you please help me ..
Thanks,
Ripal
Hello ripal,
Thank you for your post!
To sync hovering between a pair of XamDataGrids, I would recommend that you add a bool property to the data items that are bound to each of those grids. Then, you can create a Style for DataRecordCellArea which checks this property through usage of a DataTrigger bound to DataItem.BoolPropertyName. If this value is true (for example), you can set the Background color to your BackgroundHover color for the DataRecordCellArea.
What should determine what sets these properties is what record in particular you have the mouse hovered over, and which grid this belongs to. I would recommend a second style for this, which targets DataRecordPresenter. Inside of this style, I would recommend adding two event setters; one for MouseEnter, and another for MouseLeave. In the MouseEnter event, you can obtain the DataRecord from the DataRecordPresenter that the mouse has entered. Then, obtain the index of that DataRecord from its Index property. Since you wish to synchronize the hovering of your grids, you will want to check which XamDataGrid this DataRecord belongs to, which can be obtained from the DR.DataPresenter property. Once you know that, you can target the XamDataGrid.Records collection of the other grid. By using the index that you obtain from the hovered record, you can get a DataRecord at the same index in the other XamDataGrid. From that DataRecord, you can then get the DataItem, and set its new bool property to True. This will fire the DataTrigger in your DataRecordCellArea style and set the Background color of that element.
The MouseLeave event would essentially entail the same thing, except that you should be setting the bool value that determines the hover to its original value to notify the data trigger that its condition is no longer true. I have attached a sample project to demonstrate the above.