Reputation: 3515
<ScrollViewer VerticalScrollBarVisibility="Visible" Height="100">
<ItemsControl Name="icReviews" BorderBrush="Black" BorderThickness="1" Height="300">
<ItemsControl.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" >
<GradientStop Offset="1" Color="#FFFF9900" />
<GradientStop Offset="0" Color="#FFDD4400" />
</LinearGradientBrush>
</ItemsControl.Background>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="3" Width="1712" Height="300"></UniformGrid>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition ></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="1" TextElement.FontFamily="FangSong" TextElement.FontSize="15" TextElement.FontWeight="Bold" TextElement.Foreground="Blue">
<TextBlock Text="{Binding Path=Subject}" Foreground="White" TextElement.FontSize="15" TextElement.FontFamily="FangSong" TextWrapping="Wrap" Margin="5,5"></TextBlock>
<TextBlock Text="{Binding Path=Review}" Foreground="White" TextElement.FontSize="15" TextElement.FontFamily="FangSong" TextWrapping="Wrap" Margin="5,5"></TextBlock>
<WrapPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Posted by : " Foreground="White" Margin="5,5" TextElement.FontSize="15"></TextBlock>
<TextBlock Text="{Binding Path=Username}" Foreground="White" TextElement.FontSize="15" TextElement.FontFamily="FangSong" Margin="5,5"></TextBlock>
</StackPanel>
</WrapPanel>
</StackPanel>
</Grid>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
I have now edited my code with the height attribute of scrollviewer. I still cant see any scrollbars
Upvotes: 2
Views: 3900
Reputation: 132548
Are you giving your ScrollViewer
a height, or constraining it within a panel that limits the height of its children?
If the height is not limited in some way, there's no reason for the ScrollViewer
to show the scrollbars as it can grow to whatever height it needs to display its children.
You can test it by setting the VerticalScrollBarVisibility
and HorizontalScrollBarVisibility
to Visible
to see where your ScrollViewer
actually is, and if this is the case then you can fix the issue by either seting the ScrollViewer.Height
to a value, or wrapping it in a container that does not allow its children to grow to whatever size they want.
Upvotes: 6
Reputation: 722
You have to define a ControlTemplate
for ItemsPresenter
that contains a ScrollViewer
. I don't believe it includes one by default...
Upvotes: 0