Creating Viewports
Spread WinRT Documentation > Developer's Guide > Managing the User Interface > Creating Viewports

You can create horizontal or vertical viewports or both. Viewports allow you to display different parts of a large spreadsheet in a limited viewing area.

You can add a viewport in code with the AddRowViewport or AddColumnViewport method.

You can resize the viewport with the horizontal or vertical split box or bar. When the end user clicks and drags the split box, the view is split into separate viewports.You can specify whether to have a leading or trailing split box for the columns or rows with the ColumnSplitBoxPolicy and RowSplitBoxPolicy properties.

Using Code

This example creates viewports.

CS
Copy Code
private void Grid_Loaded_1(object sender, RoutedEventArgs e)
        {
            gcSpreadSheet1.AddColumnViewport(0, 100);
            gcSpreadSheet1.AddRowViewport(0, 80);
            gcSpreadSheet1.RowSplitBoxAlignment = GrapeCity.Xaml.SpreadSheet.UI.SplitBoxAlignment.Leading;
            gcSpreadSheet1.ColumnSplitBoxAlignment = GrapeCity.Xaml.SpreadSheet.UI.SplitBoxAlignment.Trailing;
            gcSpreadSheet1.Sheets[0].SetViewportHeight(0, 100);
            gcSpreadSheet1.Sheets[0].SetViewportWidth(0, 100);
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            gcSpreadSheet1.RemoveColumnViewport(0);
            gcSpreadSheet1.RemoveRowViewport(0);          
        }
VB
Copy Code
Private Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded       
        gcSpreadSheet1.AddColumnViewport(0, 100)
        gcSpreadSheet1.AddRowViewport(0, 80)
        gcSpreadSheet1.RowSplitBoxAlignment = GrapeCity.Xaml.SpreadSheet.UI.SplitBoxAlignment.Leading
        gcSpreadSheet1.ColumnSplitBoxAlignment = GrapeCity.Xaml.SpreadSheet.UI.SplitBoxAlignment.Trailing
        gcSpreadSheet1.Sheets(0).SetViewportHeight(0, 100)
        gcSpreadSheet1.Sheets(0).SetViewportWidth(0, 100)    
    End Sub
    Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)       
        gcSpreadSheet1.RemoveColumnViewport(0)
        gcSpreadSheet1.RemoveRowViewport(0)
    End Sub
See Also