2
我試圖使圖像控制在WPF同時加載源動畫。WPF圖像的加載動畫
我已經找到了解決方案,BU爲Windows 8地鐵的發展準備,它包含ImageOpened
事件,不正常WPF Image控件存在。
你知道製作圖像顯示加載動畫加載時的任何解決方案?
也許有一些圖書館與那種圖像控制的?
下面是ImageLoader的控制,我發現爲Win 8開發:
<Grid>
<Image x:Name="imgDisplay" Source="{Binding ElementName=parent,Path=Source}"
ImageFailed="OnImageFailed"
ImageOpened="OnImageOpened" />
<ContentControl
Visibility="{Binding ElementName=parent,Path=IsLoading,Converter={StaticResource converter}}"
Content="{Binding ElementName=parent,Path=LoadingContent}"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch" />
<ContentControl Visibility="{Binding ElementName=parent,Path=IsFailed,Converter={StaticResource converter}}"
Content="{Binding ElementName=parent,Path=FailedContent}"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch" />
</Grid>
和這裏的失蹤事件處理程序:
void OnImageOpened(object sender, RoutedEventArgs e)
{
this.IsLoading = false;
this.IsLoaded = true;
}
如果你的'Source'是'BitmapSource',你可以試試['BitmapSource.DownloadCompleted'](https://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapsource。 downloadcompleted(v = vs.110).aspx)事件 – dkozl