如何在uwp项目中使用FFImageLoading的FFImage

时间:2019-11-28 02:10:01

标签: xaml uwp ffimageloading

我在Nuget中下载了Xamarin.FFImageLoading.Forms,说明中说它支持uwp。我关注了FFImageLoading/samples/Simple.WinUniversal.Sample/,并在MainPage.xaml中引用了

xmlns:ff="using:FFImageLoading"
xmlns:fft="using:FFImageLoading.Transformations"

我想使用FFImage,所以

        <ff:FFImage Name="Image"
                Grid.Row="1"
                VerticalAlignment="Stretch"
                HorizontalAlignment="Stretch"
                TransformPlaceholders="False"
                LoadingPlaceholder="loading.png"
                ErrorPlaceholder="error.png"
                CacheDuration="30"
                RetryCount="3"
                RetryDelay="250"
                Height="500"
                Width="500"
                DownsampleToViewSize="True"
                DownsampleMode="None"
                Source="http://loremflickr.com/600/600/nature?filename=simple.jpg">

    </ff:FFImage>

但是设计师展示了

Unknown type 'FFImage' in XML namespace 'using:FFImageLoading'

那么,使用FFImage的正确方法是什么。谢谢。

1 个答案:

答案 0 :(得分:0)

  

如何在uwp项目中使用FFImageLoading的FFImage

请检查此line,它是Xamarin.Froms控件,不能在本机uwp项目中使用。

对于uwp平台,我们建议使用ImageEX替换该平台。有关更多信息,请参阅此document

<controls:ImageEx x:Name="ImageExControl1"
     IsCacheEnabled="True"
     Source="/Assets/Photos/LunchBreak.jpg"
     PlaceholderSource="/Assets/Photos/ImageExPlaceholder.jpg"
     Style="{StaticResource BaseStyle}"/>