Welcome to the Xceed Community | Help
Community Search  
More Search Options

Best practices to avoid lag while scrolling in Datagrid

Sort Posts: Previous Next
  •  03-16-2012, 12:55 PM Post no. 31857

    Best practices to avoid lag while scrolling in Datagrid

    Hi,

    Do you have any best practices  in order to avoid lag while scrolling in your Datagrid control (DependencyObject vs INotifiedPropertyChanged, DataTemplate, etc.)?

    I have to optimize my code because the scrolling experience is not very smooth... Where do I start?

    Thanks. 

     

    Filed under: , ,
  •  03-24-2012, 7:12 PM Post no. 31899 in reply to 31857

    Re: Best practices to avoid lag while scrolling in Datagrid

    Not sure if this'll help you - but laggy scrolling can be because you have virtualization turned on, and UIElements have to be generated as you're scrolling. If you turn off Row virtualization, it'll take longer to load up the control in the beginning, but then scrolling will be faster and smoother. Easiest way to do this is to set CanContentScroll on the grid to false, and then place the entire DataGridControl inside a ScrollViewer.

    On the contrary, if you must use row virtualization, and the lag is due to the time taken to build the new rows being scrolled into view - you might want to make sure column virtualization hasn't been turned off (IsColumnVirtualizationEnabled - true by default). If your rows have lots of columns, you can save time by only building the cells in the visible columns as you scroll, and then worry about the rest if/when the user scrolls horizontally.

    Deferred scrolling also improves the performance of scrolling, but the downside is the user can't see what row they've scrolled to until they release the scroll bar, but this can be somewhat mediated by using the TableView "ShowScrollTip" property to display information about the row at the current position of the scroll bar.

    Other none of those are really helpful to you, you might want to look at this page: http://doc.xceedsoft.com/products/xceedwpfdatagrid/Data_Virtualization.html and try messing around with using DataGridVirtualizingCollectionViewSource objects.

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.