Itemscontrol in column template is very slow

5 posts, 1 answers
  1. Pieter Jan Verfaillie
    Pieter Jan Verfaillie avatar
    11 posts
    Member since:
    Dec 2009

    Posted 12 Dec 2012 Link to this post

    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!




  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 12 Dec 2012 Link to this post

    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.

  3. Pieter Jan Verfaillie
    Pieter Jan Verfaillie avatar
    11 posts
    Member since:
    Dec 2009

    Posted 12 Dec 2012 Link to this post

    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. 
  4. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 12 Dec 2012 Link to this post

    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.

  5. Pieter Jan Verfaillie
    Pieter Jan Verfaillie avatar
    11 posts
    Member since:
    Dec 2009

    Posted 12 Dec 2012 Link to this post

    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!
Back to Top