Lazy Load Image

This commit is contained in:
Qian Bao 2020-10-23 10:45:22 +08:00 committed by 弘韬 张
parent 9d21649622
commit 0e0f24f635
2 changed files with 6 additions and 2 deletions

View file

@ -42,7 +42,7 @@
<ColumnDefinition Width="0" />
</Grid.ColumnDefinitions>
<Image x:Name="ImageIcon" Width="32" Height="32" HorizontalAlignment="Left"
Source="{Binding Image}" />
Source="{Binding Image.Value}" />
<Grid Margin="5 0 5 0" Grid.Column="1" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition />

View file

@ -18,6 +18,7 @@ namespace Flow.Launcher.ViewModel
if (result != null)
{
Result = result;
Image = new Lazy<ImageSource>(() => SetImage);
}
Settings = settings;
@ -36,8 +37,10 @@ namespace Flow.Launcher.ViewModel
public string ShowSubTitleToolTip => string.IsNullOrEmpty(Result.SubTitleToolTip)
? Result.SubTitle
: Result.SubTitleToolTip;
public Lazy<ImageSource> Image { get; set; }
public ImageSource Image
private ImageSource SetImage
{
get
{
@ -75,6 +78,7 @@ namespace Flow.Launcher.ViewModel
}
}
public override int GetHashCode()
{
return Result.GetHashCode();