I have an ItemsControl in my project which should be scrollable if there are multiple items which can not fit in view. I wrapped ItemsControl
with ScrollViewer
but it only show the scrollbar which was not working. Why the items of ItemControl are not scrollable by default since I have defined the ItemTemplate
.
Here is my XAML
<Border Style="{StaticResource styleUpdatesContentBorder}">
<ItemsControl x:Name="updateDownloadStatus" ItemsSource="{Binding LatestUpdates}">
<ItemsControl.Template>
<ControlTemplate>
<ScrollViewer x:Name="ScrollViewer" Style="{StaticResource QSFScrollViewerStyle}" VerticalScrollBarVisibility="Auto" Padding="{TemplateBinding Padding}">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Control.Margin" Value="5"/>
<Style.Triggers>
<Trigger Property="Control.IsMouseOver" Value="True">
<Setter Property="Control.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self},
Path=Content.FileName}"/>
</Trigger>
</Style.Triggers>
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Background="#01FFFFFF" BorderBrush="DarkGray" BorderThickness="1" CornerRadius="3" >
<Grid Margin="5,5,5,5">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="{Binding Activity}" Style="{StaticResource styleLatestProductUpdates}" />
<TextBlock Grid.Row="1" Text="{Binding FileName}" Style="{StaticResource styleLatestProductUpdates}"/>
<TextBlock Grid.Row="2" Text="{Binding Size}" Style="{StaticResource styleLatestProductUpdates}" />
<telerik:RadProgressBar Name="downloadProgress" Grid.Row="3"
HorizontalAlignment="Center" Width="265"
Foreground="Goldenrod" />
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Border>