【发布时间】:2017-12-19 20:45:51
【问题描述】:
对 Xamarin 表单使用 https://github.com/luberda-molinet/FFImageLoading
我的 XAML:
<forms:CachedImage
CacheType="All"
RetryDelay="1000"
DownsampleHeight="150"
RetryCount="5"
CacheDuration="1"
BackgroundColor="WhiteSmoke"
BitmapOptimizations="True"
SuccessCommand="{Binding CcCommand}"
Source = "{Binding Photo1}">
我的 ViewModel 类:
class AboutMeViewModel : INotifyPropertyChanged
{
public ICommand CcCommand { get; set; }
public AboutMeViewModel()
{
CcCommand = new Command<CachedImageEvents.SuccessEventArgs>(ffFinishLoading);
}
void ffFinishLoading(CachedImageEvents.SuccessEventArgs ea)
{
// Here I would like to call 'GetImageAsPngAsync'
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
在 ffFinishLoading 时,我想调用 GetImageAsPngAsync,但我找不到在 ViewModel 类中执行此操作的方法,因为我没有参考表单的选项:CachedImage from the XAML file to ViewModel file。
任何帮助将不胜感激。
【问题讨论】:
标签: xamarin.forms ffimageloading