【发布时间】:2019-03-14 00:55:48
【问题描述】:
您好,我想根据设备类型在列表视图中显示不同的图像,如下所示
<ContentPage.Resources>
<ResourceDictionary>
<local:Base64ToImageConverter x:Key="btoi"></local:Base64ToImageConverter>
</ResourceDictionary>
</ContentPage.Resources>
<ListView x:Name="lvImages"
VerticalOptions="FillAndExpand"
SeparatorVisibility="Default"
ItemsSource="{Binding Images}"
ItemSelected="lvImages_Selected"
HasUnevenRows="True"
SelectedItem="{Binding SelectedImage}"
IsPullToRefreshEnabled="True"
CachingStrategy="RecycleElement"
RefreshCommand="{Binding RefreshCommand}"
BackgroundColor="#009688"
SeparatorColor="#FFFFFF" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<!--<Image Source="{Binding PhoneImageData,Converter={StaticResource btoi}}" />-->
<Image>
<Image.Source>
<Binding Converter="{StaticResource btoi}">
<Path>
<OnIdiom x:TypeArguments="String">
<OnIdiom.Phone>
PhoneImageData
</OnIdiom.Phone>
<OnIdiom.Tablet>
TabletImageData
</OnIdiom.Tablet>
</OnIdiom>
</Path>
</Binding>
</Image.Source>
</Image>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
但我收到一个在 xamarin.forms.xaml 中找不到的错误字符串,请帮助..
【问题讨论】:
标签: xaml xamarin.forms