Quantcast
Viewing all articles
Browse latest Browse all 18858

ListBox and other controls in a grid not scrolling

I have a user control in which I put a ListBox and a Button in a Grid. I enclosed this grid in a ScrollViewer. Clicking on the button adds a new item to the ListBox. 

The problem is that when I add enough items to run past the length of the window, the scrollbar doesn't appear. I lose the Button so I can't add more items to the ListBox either.

Here is the XAML.

<ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="2"><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="*"/></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition Height="Auto" /><RowDefinition Height="Auto" /></Grid.RowDefinitions><ListBox x:Name="CategoriesList" Grid.Row="0" Grid.Column="0" Margin="0,4,0,0" HorizontalContentAlignment="Stretch"
                  ItemsSource="{Binding Path=Categories}" ItemTemplate="{StaticResource CategoryItemTemplate}" 
                                    SelectionMode="Multiple"></ListBox><!-- Add category --><Border Grid.Row="1" Grid.Column="0" Height="24" Background="Transparent" BorderBrush="Transparent" BorderThickness="0"><Button Command="{Binding ElementName=Manager, Path=DataContext.AddCategoryCommand}" Background="Transparent" BorderBrush="Transparent"></Button></Border></Grid></ScrollViewer>

Am I missing something?



ajaind


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>