Using Scroll Bars

You can set the scroll bar appearance, height, width, and visibility.

You can hide or show the vertical or horizontal scroll bar. You can also set the width of the vertical scroll bar and the height of the horizontal scroll bar.

You can use the thumb bar (drag button) to scroll large areas of the control. Use the button with the arrow to scroll a row or column at a time. You can also specify whether to scroll after releasing the mouse with the ScrollBarTrackPolicy property.

The control scrolls by default when selecting and dragging headers or cells outside of the current visible area.

Using Code

This example sets the scroll bar appearance, height, width, and visibility.

CS
Copy Code
private void Grid_Loaded_1(object sender, RoutedEventArgs e)
        {
            var style = new Windows.UI.Xaml.Style();
            gcSpreadSheet1.HorizontalScrollBarStyle = style;
            gcSpreadSheet1.VerticalScrollBarStyle = style;
            gcSpreadSheet1.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            gcSpreadSheet1.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            gcSpreadSheet1.HorizontalScrollBarHeight = 20;
            gcSpreadSheet1.VerticalScrollBarWidth = 20;
            gcSpreadSheet1.ScrollBarTrackPolicy = GrapeCity.Xaml.SpreadSheet.UI.ScrollBarTrackPolicy.Both;
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {           
            //Uncomment a method to test
            //gcSpreadSheet1.Sheets[0].SetActiveCell(10, 7);
            //gcSpreadSheet1.ShowActiveCell(GrapeCity.Xaml.SpreadSheet.UI.VerticalPosition.Bottom, GrapeCity.Xaml.SpreadSheet.UI.HorizontalPosition.Left);
            //gcSpreadSheet1.ShowCell(0, 0, 20, 10, GrapeCity.Xaml.SpreadSheet.UI.VerticalPosition.Bottom, GrapeCity.Xaml.SpreadSheet.UI.HorizontalPosition.Right);
            //gcSpreadSheet1.ShowColumn(0, 10, GrapeCity.Xaml.SpreadSheet.UI.HorizontalPosition.Nearest);
           gcSpreadSheet1.ShowRow(0, 50, GrapeCity.Xaml.SpreadSheet.UI.VerticalPosition.Center);
        }
VB
Copy Code
Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
        Dim style As New Windows.UI.Xaml.Style()
        gcSpreadSheet1.HorizontalScrollBarStyle = style
        gcSpreadSheet1.VerticalScrollBarStyle = style
        gcSpreadSheet1.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible
        gcSpreadSheet1.VerticalScrollBarVisibility = ScrollBarVisibility.Visible
        gcSpreadSheet1.HorizontalScrollBarHeight = 20
        gcSpreadSheet1.VerticalScrollBarWidth = 20
        gcSpreadSheet1.ScrollBarTrackPolicy = GrapeCity.Xaml.SpreadSheet.UI.ScrollBarTrackPolicy.Both     
    End Sub
    Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
        'Uncomment a method to test
        'gcSpreadSheet1.Sheets(0).SetActiveCell(10, 7)
        'gcSpreadSheet1.ShowActiveCell(GrapeCity.Xaml.SpreadSheet.UI.VerticalPosition.Bottom, GrapeCity.Xaml.SpreadSheet.UI.HorizontalPosition.Left)
        'gcSpreadSheet1.ShowCell(0, 0, 20, 10, GrapeCity.Xaml.SpreadSheet.UI.VerticalPosition.Bottom, GrapeCity.Xaml.SpreadSheet.UI.HorizontalPosition.Right)
        'gcSpreadSheet1.ShowColumn(0, 10, GrapeCity.Xaml.SpreadSheet.UI.HorizontalPosition.Nearest)
        gcSpreadSheet1.ShowRow(0, 50, GrapeCity.Xaml.SpreadSheet.UI.VerticalPosition.Center)
    End Sub
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.