Slow Autoscroll back to center
In the attached code, it gets a price from an API and then gets the record row of that price (prices are stacked vertically from low-high in each row). It then pixel scrolls the datagrid by 1 pixel every timer tick till the target price row is centered vertically. I get an exception which occurs when there is a change to the underlying collection and a scroll occurs at the same time leading to a race condition with the drawing of the grid. the datasource implements InotifyPropertyChanged and there are no explicit calls to redraw the grid. the error only occurs when there are multiple instances of the form open.
The other error is that user scrolling which interrupts the autoscroll causes the drawing of the grid to break creating weird tearing effects. How to make the autoscroll return to normal operation after user scrolls?
Ive attached source and photos in the archive.
Thanks,
Oliver
************** Exception Text **************
System.InvalidOperationException: Object is currently in use elsewhere.
at System.Drawing.Graphics.get_DpiX()
at Syncfusion.WinForms.Core.Utils.DpiAware.LogicalToDeviceUnits(Single value)
at Syncfusion.WinForms.Controls.HorizontalScrollBar.InvalidateThumbRegion()
at Syncfusion.WinForms.Controls.ScrollBarBase.set_LargeChange(Int32 value)
at Syncfusion.WinForms.DataGrid.TableControl.UpdateScrollBars()
at Syncfusion.WinForms.DataGrid.GridModel.OnRecordCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at Syncfusion.Data.CollectionViewAdv.RaiseCollectionChangedEvent(NotifyCollectionChangedEventArgs args)
at Syncfusion.Data.CollectionViewAdv.Refresh(Boolean isProgrammatic)
Attachment: ForSFusion_4ac11afc.zip
Hi ollie,
We have implemented the code you shared with us in a simple demo. Unfortunately, we are unable to replicate the exception on our end, but we are experiencing some tearing effects. We have attached the tested sample along with a video reference.
Could you please provide more information regarding the replication procedure to reproduce the mentioned exception? Additionally, we are facing a tearing issue in the demo sample. Could you confirm whether you are experiencing the same tearing effect in your application?
This information will be helpful for us to replicate and validate the issue further.
Regards,
Sreemon Premkumar M.
Attachment: WinForms_SfDataGrid_Scrolling_48220187.zip
The forms are each launched on a new single threaded apartment which caused synchronization issues with multiple forms. Ive solved this with a global timer and running them normally and no longer get the exception. the tearing issue still exists, but only after a user scrolls with the mouse.
Thanks
Hi ollie,
Thank you for the update, and we are glad that the exception was resolved on your end.
Regarding the tearing effect when scrolling the SfDataGrid with your scrolling implementation, we are a bit unclear about the reported issue. We have reviewed the images you provided, but we couldn’t identify the tearing effect based on the images alone. To help clarify, we have provided a sample along with a video reference in this response.
Could you please confirm if you are experiencing the same tearing effect in your application? If not, could you modify the provided sample and include a video reference to demonstrate the tearing issue? Please share this with us so we can replicate and investigate the tearing effect further.
This information will help us better understand and validate the issue further.
Regards,
Sreemon Premkumar M.
Attachment: WinForms_SfDataGrid_Scrolling_c3a49828.zip
calling sfDataGrid.Refresh() fixed it. just needed redrawing
Hi ollie,
Thanks for the update. We glad that you have fixed the reported issue in you end. If you need any further assistance, please let us know; we're happy to assist you.
Regards,
Sreemon Premkumar M.
- 5 Replies
- 2 Participants
-
OL ollie
- Oct 2, 2024 09:40 AM UTC
- Oct 7, 2024 05:52 AM UTC