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

Scrolling performance clunky

0 Answers 59 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 22 Nov 2013, 09:11 PM
I am trying to use the grid with about 10 columns and 1000 rows.  I am bound to an Observable collection for this, though in production I'd like to move to an IQueryable binding with paging via the datapager.  Autogenerated columns are a requirement as well as the user being able to resize/move columns.  In production, we will have anywhere from 5 to 120 columns with 1000 rows and hopefully paging.  All rows are read only and the user cannot add/remove rows or edit any cells.  When clicking the scroll handle and dragging with the mouse, the scroll behavior is very very jumpy instead of being smooth.  If you scroll VERY slowly, then it's mostly smooth, but still not quite where it should be.  Even horizontal scrolling with 2 or 3 columns off the side is clunkier than it should be.  All of the demos I've seen have very smooth scrolling and that behavior is very desirable.  I have read the degraded performance articles and have put sizes on the grid row containing the radgridview so that it does not size to "infinity".  Please point me in the right direction to get smooth performance.  Below is my View, ViewModel and Model being represented.

Thank you in advance,
Mark

MainWindow.xaml
<Window
        xmlns:my="clr-namespace:TelerikGridPrototype"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="TelerikGridPrototype.MainWindow"
        Title="MainWindow" Height="720" Width="1280" WindowStartupLocation="CenterScreen"
        DataContext="{Binding MainPageViewModel, Source={StaticResource Locator}}">
    <telerik:RadBusyIndicator IsBusy="{Binding Busy}">
 
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="660"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <telerik:RadGridView Name="gridView" ShowGroupPanel="False" IsReadOnly="True" CanUserInsertRows="False" CanUserDeleteRows="False" AreRowDetailsFrozen="True"  Grid.Row="0" ItemsSource="{Binding Records}"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
        <Button HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Content="Load" Name="btnLoad" Width="100">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Click">
                    <ei:CallMethodAction
                    TargetObject="{Binding}"
                    MethodName="LoadDataAsync"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Button>
    </Grid>
    </telerik:RadBusyIndicator>
</Window>

MainPageViewModel.cs
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using PhoenixDAL.Models;
using SimpleMvvmToolkit;
using TelerikGridPrototype.Models;
 
namespace TelerikGridPrototype
{
    public class MainPageViewModel : ViewModelBase<MainPageViewModel>
    {
        public MainPageViewModel()
        {
            Records = new ObservableCollection<record>();
        }
 
        public ObservableCollection<record> Records { get; set; }
 
        private bool busy;
        public bool Busy
        {
            get { return busy; }
            set
            {
                busy = value;
                NotifyPropertyChanged(m => m.Busy);
            }
        }
 
        public event EventHandler<NotificationEventArgs<Exception>> ErrorNotice;
 
        public async void LoadDataAsync()
        {
            Busy = true;
            var q = await Task<List<record>>.Factory.StartNew
                (
                 
                    () => DAL.Instance.Phoenix.records.Take(1000).OrderByDescending(a => a.StartTime).ToList()
                );
 
            foreach (var v in q)
            {
                Records.Add(v);
            }
            Busy = false;
        }
 
        // Helper method to notify View of an error
        private void NotifyError(string message, Exception error)
        {
            Notify(ErrorNotice, new NotificationEventArgs<Exception>(message, error));
        }
    }
}

record.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
 
namespace PhoenixDAL.Models
{
    public partial class record
    {
        [DisplayAttribute(AutoGenerateField = false)]
        public long RecordID { get; set; }
        [DisplayAttribute(Name = "Channel Name")]
        public string ChannelName { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public long StartTime { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public long StartEMCRef { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int StartPageIndex { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int StartBlockOffset { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public long EndTime { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public long EndEMCRef { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int EndPageIndex { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int EndBlockOffset { get; set; }
        [DisplayAttribute(Name = "Duration")]
        public long Duration { get; set; }
        [DisplayAttribute(Name = "Source ID")]
        public int SourceID { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public int SequenceIndex { get; set; }
        [DisplayAttribute(AutoGenerateField = false)]
        public Nullable<int> IntegrationID { get; set; }
        [DisplayAttribute(Name = "Transmission ID")]
        public string Transmission_ID { get; set; }
        [DisplayAttribute(Name = "Storage Alias")]
        public string StorageAlias { get; set; }
        [DisplayAttribute(Name = "Media Tag")]
        public Nullable<int> Media_Tag { get; set; }
        [DisplayAttribute(Name = "Media Description")]
        public string Media_Description { get; set; }
        [DisplayAttribute(Name = "Trigger Event")]
        public string Trigger_Event { get; set; }
        [DisplayAttribute(Name = "Termination Event")]
        public string Termination_Event { get; set; }
        [DisplayAttribute(Name = "Start Time")]
        public Nullable<System.DateTime> Start_Time { get; set; }
        [DisplayAttribute(Name = "End Time")]
        public Nullable<System.DateTime> End_Time { get; set; }
        [DisplayAttribute(Name = "Total Seconds")]
        public Nullable<double> Total_Seconds { get; set; }
    }
}

There is no code-behind in the xaml.cs file.

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Share this question
or