【问题标题】:Binding a Source to a asynchronous method将 Source 绑定到异步方法
【发布时间】:2017-05-27 16:15:07
【问题描述】:

您好,我有以下代码

    <controls:FlowListView x:Name="Board"
                  HasUnevenRows="true"
                  BackgroundColor="Black"
                  FlowColumnCount="3"
                  FlowItemTappedCommand="ExecuteAction">

    <controls:FlowListView.FlowColumnTemplate>
        <DataTemplate>
            <StackLayout>
                <Image VerticalOptions="FillAndExpand" Source="GetImageGivenCard"></Image>
            </StackLayout>
        </DataTemplate>
    </controls:FlowListView.FlowColumnTemplate>

</controls:FlowListView>

这个 FlowListView ItemsSource 将是一个卡片列表。 GetImageGivenCard 将是一种方法,它可以访问缓存并检索给定指定卡片的图像,所有这些都是异步的(我正在使用 Akavache)。我想要实现的目标是可能的吗?如果没有,你能给我一些替代的解决方案吗?

谢谢你们的时间。

编辑:

 Source="GetImageGivenCard"

这行当然行不通,它只是向您展示我希望获得的东西的伪代码

【问题讨论】:

    标签: xaml binding xamarin.forms


    【解决方案1】:

    使用https://github.com/luberda-molinet/FFImageLoading 这是一个很好的插件(包括缓存、异步、图像加载器、占位符)

    【讨论】:

      猜你喜欢
      • 2018-05-20
      • 2018-05-17
      • 1970-01-01
      • 2019-11-04
      • 2019-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-20
      相关资源
      最近更新 更多