Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to let ListBox scroll smoothly
    primarykey
    data
    text
    <p>There is a listbox with the following ItemContainerStyle, it's binding to the ViewModel class but when scroll the listbox its performance not smooth. I check this on the web, and I replaced the visualstackpanel with normal stackpanel in the listbox. Yes, it scrolls smoothly, but it freezes when the data is loading. Is there anything I can do?</p> <pre><code> &lt;Style TargetType="ListBoxItem" x:Key="ListBoxItem"&gt; &lt;Setter Property="Background" Value="Transparent"/&gt; &lt;Setter Property="BorderThickness" Value="0" /&gt; &lt;Setter Property="BorderBrush" Value="Transparent" /&gt; &lt;Setter Property="Padding" Value="0" /&gt; &lt;Setter Property="HorizontalContentAlignment" Value="Left"/&gt; &lt;Setter Property="VerticalContentAlignment" Value="Top"/&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="ListBoxItem"&gt; &lt;Border x:Name="LayoutBorder" BorderThickness="0.3,0.3,0.3,0.3" BorderBrush="LightCoral" CornerRadius="10" Margin="0,0.2,0,0.2"&gt; &lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name="CommonStates"&gt; &lt;VisualStateGroup.Transitions&gt; &lt;VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" /&gt; &lt;/VisualStateGroup.Transitions&gt; &lt;VisualState x:Name="Normal"/&gt; &lt;VisualState x:Name="MouseOver"&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutBorder" Storyboard.TargetProperty="BorderBrush"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="#1BA1E2"/&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;VisualState x:Name="Disabled"&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Background"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="Gray"/&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;DoubleAnimation Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Opacity" Duration="0" To=".5" /&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;/VisualStateGroup&gt; &lt;VisualStateGroup x:Name="SelectionStates"&gt; &lt;VisualState x:Name="Unselected"/&gt; &lt;VisualState x:Name="Selected"&gt; &lt;Storyboard&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutBorder" Storyboard.TargetProperty="BorderBrush"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="#1BA1E2"/&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutBorder" Storyboard.TargetProperty="BorderThickness"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="0.6"/&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="NameTextBlock" Storyboard.TargetProperty="Foreground"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="#E09728"/&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="RepostTextBlock" Storyboard.TargetProperty="Foreground"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="#1BA1E2"/&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="CommentTextBlock" Storyboard.TargetProperty="Foreground"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="#1BA1E2"/&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;ObjectAnimationUsingKeyFrames Storyboard.TargetName="FriendBorder" Storyboard.TargetProperty="BorderBrush"&gt; &lt;DiscreteObjectKeyFrame KeyTime="0" Value="#1BA1E2"/&gt; &lt;/ObjectAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="64" /&gt; &lt;ColumnDefinition Width="80" /&gt; &lt;ColumnDefinition Width="130" /&gt; &lt;ColumnDefinition Width="170" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="37" /&gt; &lt;RowDefinition Height="37" /&gt; &lt;RowDefinition Height="*" /&gt; &lt;RowDefinition Height="*" /&gt; &lt;RowDefinition Height="*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Border Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" x:Name="FriendBorder" BorderThickness="2" Margin="10,10,0,10" CornerRadius="5"&gt; &lt;Image Height="50" Width="50" HorizontalAlignment="Center" VerticalAlignment="Top" Source="{Binding ImageUrl, Mode=OneWay}" &gt; &lt;Image.Clip&gt; &lt;RectangleGeometry RadiusX="5" RadiusY="5" Rect="0, 0, 50, 50" /&gt; &lt;/Image.Clip&gt; &lt;/Image&gt; &lt;/Border&gt; &lt;TextBlock x:Name="NameTextBlock" Grid.ColumnSpan="2" Grid.Row="0" Grid.Column="1" Margin="10,6,0,0" Text="{Binding ScreenName, Mode=OneWay}" Style="{StaticResource NameTextBlockStyle}" /&gt; &lt;TextBlock x:Name="DateTextBlock" Grid.Row="0" Grid.Column="3" Margin="0,6,0,0" Text="{Binding Date, Mode=OneWay}" Style="{StaticResource MidelTextBlock}" /&gt; &lt;TextBlock x:Name="RepostTextBlock" Grid.Row="1" Grid.Column="1" Margin="10,6,0,0" Text="{Binding RepostNumb, Mode=OneWay}" Style="{StaticResource SmallTextBlock}"/&gt; &lt;TextBlock x:Name="CommentTextBlock" Grid.Row="1" Grid.Column="2" Margin="10,6,0,0" Text="{Binding CommentNumb, Mode=OneWay}" Style="{StaticResource SmallTextBlock}" /&gt; &lt;TextBlock x:Name="SourceTextBlock" Grid.Row="1" Grid.Column="3" Margin="0,3,0,0" Text="{Binding Source, Mode=OneWay}" Style="{StaticResource MidelTextBlock}" /&gt; &lt;TextBlock Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="2" Width="440" Text="{Binding Content, Mode=OneWay}" TextWrapping="Wrap" Margin="0,5,0,2" Style="{StaticResource PhoneTextSubtleStyle}" /&gt; &lt;Border Visibility="{Binding IsBusy}" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="3" Background="Gray" Width="420" Padding="5" CornerRadius="15,18,30,10" BorderThickness="2, 3, 1, 0.5" BorderBrush="Chocolate"&gt; &lt;TextBlock x:Name="OriginalTextBlock" Width="400" Margin="0,2,0,5" Text="{Binding Original, Mode=OneWay}" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}" /&gt; &lt;/Border&gt; &lt;Image Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="4" Stretch="None" Margin="0,2,0,2" HorizontalAlignment="Center" VerticalAlignment="Center" Source="{Binding ImageUrl}" &gt; &lt;/Image&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload