We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to determine if sfdatagrid is scrolled down or up?

Thread ID:

Created:

Updated:

Platform:

Replies:

130194 Apr 26,2017 10:19 PM UTC Apr 28,2017 11:48 AM UTC Xamarin.Forms 3
loading
Tags: SfDataGrid
Emil
Asked On April 26, 2017 10:19 PM UTC

I have implemented a floating button in android (it can be normal button also), I want to hide it when sfdatagrid view is scrolled down and show when scrolled up. this is usually done on recyclerview in android using CoordinatorLayout but I am not sure how to do it with sfdatagrid. I appreciate for your help. Thanks

Suhasini  Suresh [Syncfusion]
Replied On April 27, 2017 01:49 PM UTC

Hi Emil, 
 
Thanks for contacting Syncfusion Support. 
 
Your requirement to have a floating button over the datagrid and to handle its visibility based on the scrolling of the datagrid can be achieved by using the ScrollRows_Changed event of the VisualContainer. Please refer the below code example to achieve your requirement. 
 
dataGrid.GridLoaded += DataGrid_GridLoaded; 
 
private void DataGrid_GridLoaded(object sender, GridLoadedEventArgs e) 
{ 
    container = dataGrid.GetType().GetTypeInfo().GetDeclaredProperty("VisualContainer").GetValue(dataGrid) as VisualContainer; 
    container.ScrollRows.Changed += ScrollRows_Changed;             
} 
 
 
private void ScrollRows_Changed(object sender, ScrollChangedEventArgs e) 
{ 
    if (previousOffset > 0) 
    { 
        if (previousOffset > container.VerticalOffset) 
            button.IsVisible = false; 
        else 
            button.IsVisible = true; 
    } 
    else  
    {                
            button.IsVisible = false;                
    } 
    previousOffset = container.VerticalOffset; 
} 
 
 
We have prepared a sample to achieve your requirement, you can download the same from the below link. 
 
 
Regards, 
Suhasini 
 


Emil
Replied On April 27, 2017 02:57 PM UTC

hi Suhasini,

excellent support. thank you very much. this is exactly what i am looking for. thanks

Emil

Suhasini  Suresh [Syncfusion]
Replied On April 28, 2017 11:48 AM UTC

Hi Emil, 
 
Thanks for your update. Please let us know if you need any further assistance. 
 
Regards, 
Suhasini 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;