图片未显示[Xamarin.Forms] [Syncfusion]

时间:2018-12-27 14:52:40

标签: android image xamarin.forms syncfusion

我正在将Prism与Xamarin Forms一起使用,并将所有软件包都保持最新。我在项目中使用SfRotator,SfNavigationDrawer等,但是我的问题是SfRotator。旋转器中的图像未显示。我尝试使用未显示任何图像的控件。我移到FFImageLoading,它在SfRotator外部起作用,但在内部不起作用。另外,如果我在或内使用CachedImageFastRenderer,则会引发NullReferenceException

以下是代码段:

MainPage.xaml

<ContentPage xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="xxxxxx.Views.MainPage"
xmlns:navDrawer="clr-namespace:Syncfusion.SfNavigationDrawer.XForms;assembly=Syncfusion.SfNavigationDrawer.XForms"
xmlns:tabView="clr-namespace:Syncfusion.XForms.TabView;assembly=Syncfusion.SfTabView.XForms"
xmlns:rotator="clr-namespace:Syncfusion.SfRotator.XForms;assembly=Syncfusion.SfRotator.XForms"
xmlns:listView="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms"
xmlns:ffimage="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
Title="{Binding Title}">
<tabView:SfTabItem.Content>
                                    <ScrollView>
                                        <StackLayout>                                        
                                            <rotator:SfRotator ItemsSource="{Binding ImageCollection}"  BackgroundColor="Blue" x:Name="rotator" NavigationStripMode="Dots" NavigationStripPosition="Bottom" NavigationDelay="100" NavigationDirection="Horizontal">                                               
<rotator:SfRotator.ItemTemplate>                                                   
<DataTemplate>                                                       
<ffimage:CachedImage ErrorPlaceholder="Error" Source="{Binding Image}" HeightRequest="50" WidthRequest="50" LoadingPlaceholder="Loading..." />
                                                        <!--<Image Source="{Binding Image, Converter={StaticResource EmptyConverter}}" HeightRequest="100" WidthRequest="200" />-->
                                                    </DataTemplate>
                                                    <!--<DataTemplate>
                                                        <Image Source="{Binding Image}"/>
                                                    </DataTemplate>-->
                                                    <!--
                                                </rotator:SfRotator.ItemTemplate>-->
                                                </rotator:SfRotator.ItemTemplate>
                                            </rotator:SfRotator>
</StackLayout>                                  
</ScrollView>   
                            </tabView:SfTabItem.Content>                              
                        </tabView:SfTabItem>
</ContentPage>

MainPageViewModel.cs

 public class MainPageViewModel : ViewModelBase
    {

    private List imageCollection;
    public List ImageCollection
    {
    get { return imageCollection; }
    set { SetProperty(ref imageCollection, value); }
    }
    public MainPageViewModel(INavigationService navigationService)
    : base(navigationService)
    {
    Title = "Main Page";

    ImageCollection = new List();
    ImageCollection.Add(new OfferSection ("offer1.jpg", "1" ));
    ImageCollection.Add(new OfferSection ("offer2.jpg", "2" ));
    ImageCollection.Add(new OfferSection ("offer3.png", "3" ));
    }

OfferSection.cs

public class OfferSection
{

public string Image { get; set; }

public string OfferId { get; set; }

public OfferSection(string image, string id )
{
Image = image;
OfferId = id;
}

先谢谢了。等待迅速的响应

1 个答案:

答案 0 :(得分:0)

我们确认我们能够重现“ 图像未在android的旋转器中显示”的问题。我们已经记录了此问题的错误报告,并将在2018年第4卷SP1中提供此修复程序,预计将在 2019年2月的第一个星期推出。

注意:我为Syncfusion工作。