Odd horizontal scrolling in data grid

I have a page that allows 0 to many dynamically created datagrids.  Many of the grids are too wide to fit on a screen.  I wrap each grid in a ContentView and each ContentView in a ScrollViewer that is set to allow scrolling horizontally.  I'm seeing really odd behavior on the UWP app.  If I move the mouse into the grid and hover over a header cell I'm able to scroll horizontally with a gesture.  However, if I move the cursor over a cell in the grid, I can't scroll horizontally with the gesture, I can only scroll using the scroll bars.  Here is the setup for the data grids:

SfDataGrid dataGrid = new SfDataGrid();
dataGrid.AutoGenerateColumns = false;
dataGrid.Style = Content.FindByName("GridStyle") as Style;
dataGrid.VerticalOverScrollMode = VerticalOverScrollMode.None;
dataGrid.ItemsSource = tableViewModel.Data;
dataGrid.ColumnSizer = ColumnSizer.Auto;

ContentView gridWrapper = new ContentView();
gridWrapper.HorizontalOptions = LayoutOptions.StartAndExpand;
gridWrapper.VerticalOptions = LayoutOptions.StartAndExpand;
gridWrapper.HeightRequest = 1;
gridWrapper.WidthRequest = 1;
gridWrapper.SizeChanged += ContentView_SizeChanged;
gridWrapper.Content = dataGrid;

ScrollView scroller = new ScrollView();
scroller.Orientation = ScrollOrientation.Horizontal;
scroller.Content = gridWrapper;

The cells in the grid are simply labels with text in them.

3 Replies

CS Chandrasekar Sampathkumar Syncfusion Team February 22, 2021 12:27 PM UTC

Hi Nick, 
Thank you for using Syncfusion products. 
We have checked the reported query “Odd horizontal scrolling in Datagrid” from our end. Could you please share the following details which would be helpful for us to check on it and provide you solution at the earliest, 
  • Xamarin.Forms version and Syncfusion version used in your application
  • ContentView_SizeChanged event handler method codes
Regards, 
Chandrasekar Sampathkumar 



NI Nick February 22, 2021 04:19 PM UTC

Xamain.Forms: 5.0.0.1931
SyncFusion.Xamarin.SfDataGrid: 18.4.0.39
SyncFusion.Xamarin.Core: 18.4.0.39

The size changed event just hides an ActivityIndicator.
private void ContentView_SizeChanged(object sender, EventArgs e)
{
    ContentView contentView = sender as ContentView;
    if (contentView.Height > 10)
    {
        foreach (View child in ((StackLayout)contentView.Parent.Parent).Children)
        {
            Label label = child as Label;
            if (label != null)
            {
                label.IsVisible = false;
                continue;
            }

            ActivityIndicator indicator = child as ActivityIndicator;
            if (indicator != null)
            {
                indicator.IsRunning = false;
                indicator.IsVisible = false;
            }
        }
    }
}


PK Pradeep Kumar Balakrishnan Syncfusion Team February 23, 2021 01:50 PM UTC

Hi Nick, 
 
Thank you for the update. 
 
We have prepared sample based on the shared information and checked the reported query “Able to scroll the grid using mouse gesture in header cell but same is not working in grid cells in Xamarin forms UWP.” Unfortunately, we cannot be able to replicate the reported behavior and we have attached the tested sample and video reference for the same. 
 
SfDataGrid can be scrolled in UWP using scrollbars or screen touch and DataGrid will not allow scrolling using mouse gesture. 
 
In case, if you are still facing the issue from your side. Please modify the attached sample to reproduce the issue. which will be helpful for us to validate the issue and provide you the solution at earlier.  
 
Regards, 
Pradeep Kumar B 


Loader.
Up arrow icon