954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

ListBox doesn't scroll

I have a ListBox using an ItemTemplate. Here is the XAML:

<ListBox Name="list_Sensors" ItemsSource="{Binding}" Grid.Column="0" IsSynchronizedWithCurrentItem="True">
            <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <GroupBox Header="Part Number/Description" Grid.Column="0" Margin="5" Width="200">
                                <StackPanel>
                                    <TextBlock Text="{Binding Path=PartNumber}" HorizontalAlignment="Center"/>
                                    <TextBlock TextWrapping="Wrap" FontSize="8" HorizontalAlignment="Center">
                                        <TextBlock.Text>
                                            <MultiBinding StringFormat="{}{0} {1}">
                                                <Binding Path="Manufacturer" />
                                                <Binding Path="Description" />
                                            </MultiBinding>
                                        </TextBlock.Text>
                                    </TextBlock>
                                </StackPanel>
                            </GroupBox>

                            <GroupBox Grid.Column="1" Margin="5">
                                <StackPanel>
                                    <TextBlock Text="{Binding Path=PointValue, StringFormat='{}Points : {0}'}" HorizontalAlignment="Center" />
                                    <CheckBox Content="Counts as Drop?" IsChecked="{Binding Path=IsDrop, Mode=OneTime}" HorizontalAlignment="Center"/>
                                </StackPanel>
                            </GroupBox>

                            <Border Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="Black" CornerRadius="4" />
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>


The data comes from a static list in a different class. The list builds just fine. It just doesn't give me the option to scroll - which is a problem considering there are 37 items in the list. I'm attaching a screenshot to show what I mean.

Attachments Nonscrolling_Listbox.jpg 78.31KB
toadzky
Junior Poster in Training
96 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

Maybe you are missing columns definitions.

<Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"></ColumnDefinition>
            <ColumnDefinition Width="auto"></ColumnDefinition>
            <ColumnDefinition Width="auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
       
        <ListBox Name="list_Sensors" ItemsSource="{Binding}" 
......
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

The Grid in the XAML code is for a DatatTemplate inside the ListBox. And it has ColumnDefinitions.

toadzky
Junior Poster in Training
96 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: