Reputation: 792
Load more data when scroll bar reached in last row in DevExpress
GridControl
using wpf?
I have 100 rows in my GridControl
in DevExpress
but I want to Load 20 at the loading time and next 20 data will load when we scroll down in GridControl
. Basically I want a event of GridControl
when GridControl
Scrollbar reached in last row, next 20 data will load, so is there solution please help me.
Any help will be appreciated!
Upvotes: 1
Views: 727
Reputation: 301
You can create a behavior for this and attach it to TableView which is under GridControl. Also you can provide a command for behavior to execute when bottom is reached through attached property. Hope this helps.
public class IsScrolledToBottomBehavior : Behavior<TableView>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.AddHandler(ScrollViewer.ScrollChangedEvent, new ScrollChangedEventHandler(OnScrollChanged));
}
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.RemoveHandler(ScrollViewer.ScrollChangedEvent, new ScrollChangedEventHandler(OnScrollChanged));
}
private void OnScrollChanged(object sender, ScrollChangedEventArgs e)
{
if(((ScrollViewer)e.OriginalSource).VerticalOffset == ((ScrollViewer)e.OriginalSource).ScrollableHeight)
{
// do rows loading here
}
}
}
Upvotes: 1