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

Expander as ListBox Item Scrolling Issue

1 Answer 126 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Colin Cowie
Top achievements
Rank 1
Colin Cowie asked on 28 Jun 2010, 10:49 AM
Hi,

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"
                <ListBox.ItemTemplate> 
                    <DataTemplate> 
                        <telerik:RadExpander Header="{Binding HeaderText}" Content="{Binding ContentText}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
 
                        </telerik:RadExpander> 
                    </DataTemplate> 
                </ListBox.ItemTemplate> 
            </ListBox> 
    </Grid> 

 public class MyObj 
    { 
        public string HeaderText {getset;} 
        public string ContentText {getset;} 
    } 
    public partial class MainPage : UserControl 
    { 
 
        public ObservableCollection<MyObj> MyList; 
 
        public MainPage() 
        { 
            InitializeComponent(); 
            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.

Thanks,

Colin Cowie.



1 Answer, 1 is accepted

Sort by
0
Viktor Tsvetkov
Telerik team
answered on 01 Jul 2010, 12:34 PM
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
Tags
Expander
Asked by
Colin Cowie
Top achievements
Rank 1
Answers by
Viktor Tsvetkov
Telerik team
Share this question
or