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.31 KB

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}" 
......

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

This article has been dead for over six months. Start a new discussion instead.