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

Slow performance on Custom GridViewDataColumn

4 Answers 254 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paulo
Top achievements
Rank 1
Paulo asked on 31 Oct 2011, 06:47 PM
Hello guys I'm experiencing slow load performance with this simple code:
using System.Linq;
using System.Windows;
using System.Windows.Data;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
  
namespace SilverlightApplication1
{
    public partial class MainPage 
    {
        public MainPage()
        {
            InitializeComponent();
            gv.AutoGenerateColumns = false;
            gv.EnableRowVirtualization = true;
            gv.Columns.Add(new GridViewDataColumn2("ID"));
            gv.Columns.Add(new GridViewDataColumn2("Name"));
            DataContext = new ObservableCollection<MyObject>(from i in Enumerable.Range(0, 1000) select new MyObject { Id = i, Name = string.Format("Name{0}", i) });
        }
    }
  
    public class GridViewDataColumn2 : GridViewDataColumn
    {
        private readonly string _propertyName;
  
        public GridViewDataColumn2(string propertyName)
        {
            _propertyName = propertyName;
        }
  
        public override FrameworkElement CreateCellElement(GridViewCell cell, object dataItem)
        {
            var auc = new RadMaskedTextInput();
            auc.SetBinding(RadMaskedTextInput.ValueProperty, new Binding(_propertyName));
  
            return auc;
        }
    }
  
    public class MyObject
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }
}
Xaml:
<UserControl x:Class="SilverlightApplication1.MainPage"
    xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
  
  <ScrollViewer x:Name="LayoutRoot" Background="White">
    <Controls:RadGridView x:Name="gv" ItemsSource="{Binding}" />
  </ScrollViewer>
</UserControl>


The problem is on Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureChild(class System.Windows.UIElement,valuetype System.Windows.Size,int32)  Telerik.Windows.Controls.GridView.dll because it is causing an unwanted MeasureOverride.


4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 01 Nov 2011, 08:17 AM
Hello,

 I strongly suggest you to read our documentation!

Measuring UI virtual items controls like RadGridView, DataGrid, ListBox, etc. with infinity will turn off the virtualization and the component will try to create all UI containers at once. 

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 30 Nov 2011, 03:04 AM
Where is that in your documentation?

Is it better than this documentation:  

GridViewDataControl.ExpandAllHierarchyItems Method
Expands all hierarchy items.


0
Vlad
Telerik team
answered on 30 Nov 2011, 07:42 AM
Hi,

 Here is it:
http://www.telerik.com/help/silverlight/gridview-troubleshooting-performance.html

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 14 Dec 2011, 10:05 PM
Actually, telerik was causing a bug in .net's UIAutomation code to surface..  

for more info:
http://social.msdn.microsoft.com/Forums/en/windowsaccessibilityandautomation/thread/6c4465e2-207c-4277-a67f-e0f55eff0110

Tags
GridView
Asked by
Paulo
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Peter
Top achievements
Rank 1
Share this question
or