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. Image for the cookie policy date

SfDataGrid how to find if HScrollBar is available or not.


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. 


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

3 Replies

AR Akila Rajaram Syncfusion Team 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.



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 .



Akila R.


Attachment: SfDataGridSample_7f3e1833.zip

VA Vasanth April 30, 2015 02:03 PM UTC

That worked, thanks!

SC Saranya CJ Syncfusion Team 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.


Live Chat Icon For mobile
Up arrow icon