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

SfDataGrid how to find if HScrollBar is available or not.

Thread ID:

Created:

Updated:

Platform:

Replies:

118971 Apr 29,2015 04:08 PM UTC May 1,2015 04:03 AM UTC WinRT 3
loading
Tags: SfDataGrid
Vasanth
Asked On April 29, 2015 04:08 PM UTC

Hi,

I am using below property to see if Horizontal scroll bar is null or not, but it throws null reference exception even when trying to see if HScrollBar is availabe or not. 

SfDataGrid.AutoScroller.HScrollBar

Is there any other way I can check if Horizontal scroll bar is visible or not?

Akila Rajaram [Syncfusion]
Replied On April 30, 2015 11:36 AM UTC

Hi Vasanth ,

 

Thank you for using  Syncfusion Products .

 

We analyzed your query.The HScrollBar will  provide scroll information value  of (VisualContainer’s)horizontal scrollbar  and its value will  be initialized when SfDataGrid is loaded.You can identify the visibility of horizontal scrollbar by using ComputedHorizontalScrollBarVisibility property of VisualContainer.We have prepared the sample based on your requirement to identify horizontal scrollbar visibility in Loaded event of SfDataGrid . Please find the attached sample .

 

Please refer the following code snippet for accessing ComputedHorizontalScrollBarVisibility of VisualContainer and you can get VisualContainer by using GetVisualContainer() helper method in SfDataGrid.

 

C#:

void grid_Loaded(object sender, RoutedEventArgs e)

{          

    var VisualContainer = this.grid.GetVisualContainer();           

    var HorizontalScrollbarVisibility=VisualContainer.ScrollOwner.ComputedHorizontalScrollBarVisibility;                      

}  

 

Note : For accessing GetVisualContainer() helper method, you need to add the using Syncfusion.UI.Xaml.Grid.Helpers; namespace .

 

Please let us know if this solution helps you .

 

Regards,

Akila R.

 


Attachment: SfDataGridSample_7f3e1833.zip

Vasanth
Replied On April 30, 2015 02:03 PM UTC

That worked, thanks!

Saranya CJ [Syncfusion]
Replied On May 1, 2015 04:03 AM UTC

Hi Vasanth,

Thank you for your update. We are glad to know the reported issue has been fixed. Please let us know if you require any other assistance.

Regards,
Saranya

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

;