Expander as ListBox Item Scrolling Issue

2 posts, 0 answers
  1. Colin Cowie
    Colin Cowie avatar
    1 posts
    Member since:
    Aug 2009

    Posted 28 Jun 2010 Link to this post


    I am using an expander as a listbox item, and it is all working well, except when expanding mutiple items and then scrolling the listbox using the vertical scrollbar.  When more than one item is expanded, when you scroll down it seems like other listbox items further down in the list are also being expanded, randomly.

    The real example has images etc.. in the expander content, but a much simplified xaml and code-behind snippet below also shows the problem I am having:

    <Grid x:Name="LayoutRoot" Width="96" Height="900" HorizontalAlignment="Left" VerticalAlignment="Top" > 
                <ListBox x:Name="ListBox1" Height="400" Width="Auto" 
                         HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                            <telerik:RadExpander Header="{Binding HeaderText}" Content="{Binding ContentText}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"

     public class MyObj 
            public string HeaderText {getset;} 
            public string ContentText {getset;} 
        public partial class MainPage : UserControl 
            public ObservableCollection<MyObj> MyList; 
            public MainPage() 
                MyList = new ObservableCollection<MyObj>(); 
                for (var i = 0 ; i < 100; i++) 
                    MyList.Add(new MyObj() {HeaderText = i.ToString(), ContentText = i.ToString()}); 
                ListBox1.ItemsSource = MyList; 

    If you run the above example, and expand any two items (other than the very top two for some reason), and then scroll with the scrollbar, items further down in the list will be expanded also.

    We're using the Silverlight 4 tools, Q1 SP1 release.

    Any pointers you could give on the above, as to whether this is a bug, or I'm templating the data incorrectly or whatever, and any workarounds, would be great.


    Colin Cowie.

  2. Viktor Tsvetkov
    Viktor Tsvetkov avatar
    382 posts

    Posted 01 Jul 2010 Link to this post

    Hello Colin Cowie,

    This is a problem with the virtualizing stack panel of the ListBox. Attached is a modified project with two SDK's Expander and two RadExpander, one with virtualization and one without.

    On a side note, I'd like to inform you that we've just released an online tool that allows you to reduce the size of your Silverilght applications. For more information, please visit http://blogs.telerik.com/blogs/posts/10-06-10/telerik_assembly_minifier.aspx

    Best wishes,
    Viktor Tsvetkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top