views:

271

answers:

1

I have a ListBox in a grid that gets databound when the page loads... pretty straightforward. The problem I'm having is that, after the box is databound, I can scroll... but not all the way to the bottom of the list. It stops an item or two short and won't let me scroll anymore. Here's the listbox XAML:

<Grid x:Name="ContentGrid" Grid.Row="2">
        <ListBox x:Name="lbFeed" ItemsSource="{Binding Items}" SelectionChanged="lbFeed_SelectionChanged" VerticalAlignment="Top" Width="480">
            <ListBox.ItemTemplate>
                <DataTemplate x:Key="MyDataTemplate">
                    <StackPanel Orientation="Vertical" Width="430">
                        <TextBlock Text="Some text" TextAlignment="Center" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>

I can post more code, but I'm still getting my feet wet in XAML and I'm not sure what might be causing this. If you need more context, let me know and I'll add it here.

A: 

Hi Byron,

This is a known issue at this stage of ctp release if you happen to have rows that are not fixed height. If this is the case you will likely notice your scrolling is a bit jittery too. Fix the height of your content for now if this is the case for your app and all is resolved.

Mick N
You're right and I can add one thing. I severely over-simplified my code example above. I actually had a mechanism that selected different dataTemplates based on the type of the data behind the listboxitem. I had read some forum posts that said to make everything fixed width, but they didn't neccessarily say they all had to be the same width. For this fix, THEY DO. I went back and set all my datatemplates to the same fixed width and all is well (until they fix the problem, that is).
Byron Sommardahl
The fixed width aspect is often mentioned in the context of wrapping to constrain contents within the display area. As opposed to fixed height which is a workaround to the current scrolling issue.
Mick N
I added a Height to my Stackpanel within my DataTemplate but the problem still remains! Maybe because it is in a PivotItem? http://stackoverflow.com/questions/4020890/wp7-listbox-scrolling-cant-stay-on-very-last-item-fixed-height-does-not-help
Rodney