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

Itemscontrol in column template is very slow

4 Answers 600 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pieter Jan Verfaillie
Top achievements
Rank 1
Pieter Jan Verfaillie asked on 12 Dec 2012, 03:44 PM
Hi, 


For one of the columns in my gridview, I need to use an ItemsControl. That column is bound to a variable list of 'events', which are strings. For each of these events, a link/button needs to be generated in the column. 

My column is defined as follows:

<telerik:GridViewDataColumn Header="Actions">
    <telerik:GridViewColumn.CellTemplate>
        <DataTemplate>
<ItemsControl ItemsSource="{Binding Path=Events}">
     <ItemsControl.ItemTemplate>
         <DataTemplate>
            <Button cal:Message.Attach="ExecutePipEvent($dataContext)" Content="{Binding}"/>
         </DataTemplate>
         </ItemsControl.ItemTemplate>
     <ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
       <StackPanel Orientation="Horizontal"/>
    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
        </DataTemplate>
    </telerik:GridViewColumn.CellTemplate>
</telerik:GridViewDataColumn>


The problem is that this column makes the rendering of each row very slow. Without this row however, the grid is rendered fast. 

Anyone experienced the same problem or knows what the problem is? That would be great!




4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Dec 2012, 03:48 PM
Hi,

 If you have large items collection for this ItemsControl you will get performance problems since there is no UI virtualization. If you want you can use some virtualized ItemsControl like ListBox to avoid such problems. 

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Pieter Jan Verfaillie
Top achievements
Rank 1
answered on 12 Dec 2012, 03:53 PM
Hi Vlad, 


Thanks for the quick response. 

The collection in the itemscontrol isn't big at all. It's max 5 or 6 items. It seems to few to cause such a performance issue. 
0
Accepted
Vlad
Telerik team
answered on 12 Dec 2012, 03:54 PM
Hello,

 According to the code you have also attached behavior for the Button. Can you remove it temporary to see if you will get any performance improvement?

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Pieter Jan Verfaillie
Top achievements
Rank 1
answered on 12 Dec 2012, 04:04 PM
Vlad, 


Great, that is the cause indeed. I'm using Caliburn Micro as mvvm framework. So I suppose it's the binding process of caliburn that is the bottleneck here. 

Thanks for the quick solution!
Tags
GridView
Asked by
Pieter Jan Verfaillie
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Pieter Jan Verfaillie
Top achievements
Rank 1
Share this question
or