Crashes while searching data beyond the scrollable area.
The following is the key response code.
after click test1, and search for 200,
System.ArgumentOutOfRangeException: 200 out of range 0 to 102
参数名: index
在 Syncfusion.UI.Xaml.Grid.ScrollAxis.DistanceRangeCounterCollection.CheckRange(String paramName, Int32 from, Int32 to, Int32 actualValue)
在 Syncfusion.UI.Xaml.Grid.ScrollAxis.DistanceRangeCounterCollection._GetCumulatedDistanceAt(Int32 index)
在 Syncfusion.UI.Xaml.Grid.ScrollAxis.DistanceRangeCounterCollection.GetCumulatedDistanceAt(Int32 index)
在 Syncfusion.UI.Xaml.Grid.ScrollAxis.PixelScrollAxis.ScrollInView(Int32 lineIndex, Double lineSize)
在 Syncfusion.UI.Xaml.Grid.ScrollAxis.ScrollAxisBase.ScrollInView(Int32 lineIndex)
在 Syncfusion.UI.Xaml.CellGrid.GridCurrentCell.ScrollInView(RowColumnIndex rowColumnIndex)
在 Syncfusion.UI.Xaml.CellGrid.GridCurrentCell.SelectCurrentCell(Int32 row, Int32 col, GridColumn gridColumn)
在 Syncfusion.UI.Xaml.CellGrid.GridCurrentCell.MoveCurrentCell(RowColumnIndex rowColIndex, GridColumn gridColumn, Boolean forceMove, ActivationTrigger activationTrigger)
在 Syncfusion.UI.Xaml.CellGrid.SelectionController.AddSelection(GridRangeInfo range)
在 Syncfusion.UI.Xaml.Spreadsheet.Commands.FindAndReplaceWindow.MoveCurrentCell(IRange found_Range)
在 Syncfusion.UI.Xaml.Spreadsheet.Commands.FindAndReplaceWindow.FindNextButton_Click(Object sender, RoutedEventArgs e)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
Thank you for providing detailed information regarding the issue you are experiencing. Based on the details shared, we understand that you are encountering an issue when searching for text in a spreadsheet. From your code snippet, it appears that you updated the row count at runtime but only updated the `ActiveGrid.RowCount`. As a result, the `DefaultRowCount` was not updated, leading to an `IndexOutOfRangeException`.
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { spreadsheet.DefaultRowCount = 1000; spreadsheet.ActiveGrid.RowCount = 1000; var worksheet = spreadsheet.ActiveSheet; for(int i = 1; i < 1000; i++) { var range = worksheet.Range[i, 1]; spreadsheet.ActiveGrid.SetCellValue(range,cellValue:i.ToString()); } } |
Regards,
After implementing DefaultRowCount, the scroll region works properly, but crashes still occur when repeatedly modifying row counts and searching.
see the code below and the attachment.
Attachment: 20241128142833_WindowShot_6648ad0.zip
Thank you for providing the details. Based on the information shared, we understand that you encountered an exception while resetting the DefaultRowCount and ActiveGridRowCount during a record search. After reviewing the provided code snippet, we observed that within the ButtonBase_OnClick2 event, the DefaultRowCount and ActiveGridRowCount were set to 100. However, the exception occurred because a search was attempted beyond the available rows.
- 3 Replies
- 2 Participants
-
CR crosslife
- Nov 27, 2024 03:48 AM UTC
- Nov 29, 2024 01:16 PM UTC