0
在下面的代码中,当用户在列表框中选择一个项目时,我正在使用不同的图像ImageUrlHoverString
。如何以简单的方式预加载图像?
这是一个很大的图像,我看到加载图像时的几分钟的差距。 你知道一个简单的方法来预载这个图像,所以这个毛刺不会再发生了吗?
<Image x:Name="FloorImage"
Grid.Row="1"
Margin="0,0,0,0"
Height="70">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Source" Value="{Binding ImageUrlString}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
<Setter Property="Source" Value="{Binding ImageUrlHoverString}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
你可能想使用折叠知名度所以也没有预留空间 – Chris