Is there an easy way, in C#, to find if the vertical and/or horizontal scroll bar is visible?
Thanks
Dan
Hi Dan -
I assume you are talking abou the scrollbars in the XamDataGrid - short of traversing the tree of visual descendants in the XamDataGrid looking for the scrollbars and then checking their Visibility, you should be able to do the following:
if (this.xamDataGrid1.ScrollInfo.ViewportWidth > this.xamDataGrid1.ScrollInfo.ExtentWidth) Debug.WriteLine("Horizontal Scrollbar is NOT visible"); else Debug.WriteLine("Horizontal Scrollbar is visible"); if (this.xamDataGrid1.ScrollInfo.ViewportHeight > this.xamDataGrid1.ScrollInfo.ExtentHeight) Debug.WriteLine("Vertical Scrollbar is NOT visible"); else Debug.WriteLine("Vertical Scrollbar is visible");
if (this.xamDataGrid1.ScrollInfo.ViewportWidth > this.xamDataGrid1.ScrollInfo.ExtentWidth)
Debug.WriteLine("Horizontal Scrollbar is NOT visible");
else
Debug.WriteLine("Horizontal Scrollbar is visible");
if (this.xamDataGrid1.ScrollInfo.ViewportHeight > this.xamDataGrid1.ScrollInfo.ExtentHeight)
Debug.WriteLine("Vertical Scrollbar is NOT visible");
Debug.WriteLine("Vertical Scrollbar is visible");
Joe