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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get reference to the VisualContainer of a SfDataGrid?

Thread ID:

Created:

Updated:

Platform:

Replies:

148091 Oct 4,2019 06:47 PM UTC Oct 11,2019 10:58 AM UTC Xamarin.Forms 4
loading
Tags: SfDataGrid
Tung
Asked On October 4, 2019 06:47 PM UTC


I follow this ticket  #  142708 to update the SfListView content,  reserving the current view. It works perfect.

How can i achieve the same thing with SfDataGrid?

SfDataGridHeHelpers doesn't have GetVisualContainer as SfListView does.

Thank you.

Karthikraja Kalaimani [Syncfusion]
Replied On October 7, 2019 01:27 PM UTC

Hi Tung,

 
Thanks for contacting Syncfusion support.

We have prepared sample for your reported query “How to get VisualContainer of SfDataGrid”. Please follow the below code snippet and sample.


 
[.CS] 
double yPosition; 
        ExtendedScrollView ScrollView; 
        AndroidScrollView androidScrollView; 
        public MainPage() 
        { 
            InitializeComponent(); 
           
            dataGrid.GridLoaded += DataGrid_GridLoaded; 
        } 
 
        private async void DataGrid_GridLoaded(object sender, GridLoadedEventArgs e) 
        { 
            var container =(VisualContainer) dataGrid.GetType().GetProperty("VisualContainer", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(dataGrid); 
 
            if (Device.RuntimePlatform == Device.Android) 
            { 
                androidScrollView = (AndroidScrollView)container.GetType().GetRuntimeProperties().FirstOrDefault(x => x.Name == "AndroidScrollOwner").GetValue(container); 
            } 
            else 
            { 
                ScrollView = (ExtendedScrollView)container.GetType().GetRuntimeProperties().FirstOrDefault(x => x.Name == "ScrollOwner").GetValue(container); 
            } 
        } 
 
        private void Button_Clicked(object sender, EventArgs e) 
        { 
            if (Device.RuntimePlatform == Device.Android) 
            { 
                yPosition = androidScrollView.ScrollY; 
            } 
            else 
            { 
                yPosition = ScrollView.ScrollY; 
            }    
        } 
 
        private async void Button_Clicked_1(object sender, EventArgs e) 
        { 
            if (Device.RuntimePlatform == Device.Android) 
            { 
                await (androidScrollView as ExtScrollViewer).ScrollToAsync(0, yPosition,false); 
            } 
            else 
            { 
                await (ScrollView as ScrollView).ScrollToAsync(0, yPosition,false); 
            } 
        } 
 
 
 
 
 
Please let us know, if you need any further assistance from us. 
 
 
Regards, 
Karthik Raja 


Tung
Replied On October 10, 2019 02:09 AM UTC

Thank you for the sample,

It works fine at my end. 

Do you plan to add this function to the Helper to remove all complexity with reflection ?



Balasubramani Sundaram [Syncfusion]
Replied On October 10, 2019 10:18 PM UTC

Hi Tung,   
  
Thanks for the update,   
 
We have logged a feature request of “Accessing a visual control generic” for the same and we will implement this feature and we will include in our upcoming 2019 Volume 3 SP1 release which is estimated to be available on end of November. We appreciate your patience until then.  
  
We will provide the feedback link on October 11th, 2019 from that you can track the status of the report.  
  
Regards,   
Balasubramani Sundaram.  


Farjana Parveen Ayubb [Syncfusion]
Replied On October 11, 2019 10:58 AM UTC

Hi Tung,

Thank you for your patience.

As we promised earlier the requested feature is included in our 2019 Volume 3 SP1, which is available in end of November 2019. For further details, please follow the feedback link,  
 
  
 
Note: The provided feedback link is private, and you need to login to view this feedback. 
 
Regards,   
Farjana Parveen A 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon