This is a migrated thread and some comments may be shown as answers.

Vertical Scrollbar changes sizes when scrolling

4 Answers 107 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Darryn
Top achievements
Rank 1
Darryn asked on 18 Jul 2012, 02:52 PM
I am having an issue with the scroll bar on some of my gridviews. I am binding the itemssource to an observable collection of business objects. The size it shows the scroll bar when the data is first loaded, is smaller than the size of the scroll bar after I scroll through the data. 

Is there some property I need to set so that it detects the number of rows in a collection before drawing the scroll bar?

I have a attached a screen shot showing the issue. The first gridview shows the scroll bar after the data is initially loaded. The second shows the scroll bar after scrolling through the data.

4 Answers, 1 is accepted

Sort by
0
Vera
Telerik team
answered on 19 Jul 2012, 09:01 AM
Hi David,

 
I tried to reproduce the issue but to no avail. Attached you can find the project I used for the test. Are you able to get the described problem on it? 

Kind regards,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Darryn
Top achievements
Rank 1
answered on 19 Jul 2012, 02:41 PM
Here is a simple example:

<Window x:Class="telerik.MainWindow"
        Title="MainWindow" Height="350" Width="525" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <Grid>
        <telerik:RadGridView HorizontalAlignment="Left" Name="rgv" VerticalAlignment="Top" Height="264" Width="503" />
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="12,276,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
    </Grid>
</Window>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections.ObjectModel;
 
namespace telerik
{
    public partial class MainWindow : Window
    {
        public ObservableCollection<TestData> test = new ObservableCollection<TestData>();
 
        public MainWindow()
        {
            InitializeComponent();
 
            rgv.ItemsSource = test;
        }
 
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < 30; i++)
            {
                test.Add(new TestData{ Col1 = i, Col2 = i, Col3 = i, Col4 = i, Col5 = i, Name = i.ToString()});
            }
        }
    }
 
    public class TestData : INotifyPropertyChanged
    {
        private string _name;
        private int _col1;
        private int _col2;
        private int _col3;
        private int _col4;
        private int _col5;
 
        public string Name
        {
            get { return _name; }
            set
            {
                if (value == _name)
                    return;
                _name = value;
                OnPropertyChanged("Name");
            }
        }
 
        public int Col1
        {
            get { return _col1; }
            set
            {
                if (value == _col1)
                    return;
                _col1 = value;
                OnPropertyChanged("Col1");
            }
        }
 
        public int Col2
        {
            get { return _col2; }
            set
            {
                if (value == _col2)
                    return;
                _col2 = value;
                OnPropertyChanged("Col2");
            }
        }
 
        public int Col3
        {
            get { return _col3; }
            set
            {
                if (value == _col3)
                    return;
                _col3 = value;
                OnPropertyChanged("Col3");
            }
        }
 
        public int Col4
        {
            get { return _col4; }
            set
            {
                if (value == _col4)
                    return;
                _col4 = value;
                OnPropertyChanged("Col4");
            }
        }
 
        public int Col5
        {
            get { return _col5; }
            set
            {
                if (value == _col5)
                    return;
                _col5 = value;
                OnPropertyChanged("Col5");
            }
        }
 
        private event PropertyChangedEventHandler propertyChanged;
        public event PropertyChangedEventHandler PropertyChanged
        {
            add
            {
                if (propertyChanged == null || !propertyChanged.GetInvocationList().Contains(value))
                {
                    propertyChanged += value;
                }
            }
            remove
            {
                propertyChanged -= value;
            }
        }
        protected virtual void OnPropertyChanged(string propertyName)
        {           
            PropertyChangedEventHandler handler = this.propertyChanged;
            if (handler != null)
            {
                var e = new PropertyChangedEventArgs(propertyName);
                handler(this, e);
            }
        }
    }
}

I attached a screenshot showing the problem again. 
0
Darryn
Top achievements
Rank 1
answered on 19 Jul 2012, 02:56 PM
I found that if I put:

EnableRowVirtualization = False

the problem goes away. Is this the only solution?
0
Vera
Telerik team
answered on 19 Jul 2012, 03:05 PM
Hi David,

 
Thank you for the additional details. We were able to reproduce the reported issue. I tested it with our Latest Internal Build and it was no longer reproducible. Please download the Internal Build and give it a try.

Let us know in case you still get the problem on your side.

Kind regards,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Darryn
Top achievements
Rank 1
Answers by
Vera
Telerik team
Darryn
Top achievements
Rank 1
Share this question
or