Vertical scrolling

Posted by: Luis.Alvarez on 5 July 2018, 9:09 am EST

    • Post Options:
    • Link

    Posted 5 July 2018, 9:09 am EST

    Hi,

    My spreadsheet sheet is contained within a border and I have assigned a rowcount. The sheet is displayed within this border along with the vertical scroll bar as expected. I noticed that when I scroll down to the bottom of the sheet I can scroll past the maximum number of rows assigned by rowcount. Is there a way to stop the vertical scrolling from going past the last row and show empty space? Can I have the scrolling stop when the last row comes into view at the bottom?

    Thanks

    Luis

  • Posted 5 July 2018, 7:29 pm EST

    Hi Luis,

    With Spread for WPF/SL there is no direct way to control the scrolling as per the row/column count. We have TopRowChanged and LeftColumnChanged events where we can manipulate the top row and left column position after scroll to restrict the user to not scroll pass the last row and column. Here is the code to do that:

    
    private void gcSpreadSheet1_TopRowChanged(object sender, GrapeCity.Windows.SpreadSheet.UI.ViewportEventArgs e)
            {
                if (e.NewIndex == gcSpreadSheet1.ActiveSheet.RowCount - 1)
                {
                    gcSpreadSheet1.ShowRow(0, e.NewIndex, GrapeCity.Windows.SpreadSheet.UI.VerticalPosition.Bottom);
                    gcSpreadSheet1.Invalidate();
                }
             
            }
    
            private void gcSpreadSheet1_LeftColumnChanged(object sender, GrapeCity.Windows.SpreadSheet.UI.ViewportEventArgs e)
            {
                if (e.NewIndex == gcSpreadSheet1.ActiveSheet.ColumnCount - 1)
                {
                    gcSpreadSheet1.ShowColumn(0, e.NewIndex, GrapeCity.Windows.SpreadSheet.UI.HorizontalPosition.Right);
                    gcSpreadSheet1.Invalidate();
                }
            }
    
    

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels