【问题标题】:Image not being displayed [Xamarin.Forms][Syncfusion]图像未显示 [Xamarin.Forms][Syncfusion]
【发布时间】:2019-05-25 14:14:55
【问题描述】:

我正在将 Prism 与 Xamarin Forms 一起使用,并且所有软件包都是最新的。我在我的项目中使用 SfRotator、SfNavigationDrawer 等,但我的问题在于 SfRotator。旋转器中的图像未显示。我尝试使用不显示任何图像的控件。我搬到了 FFImageLoading,它在 SfRotator 外部但不在内部工作。此外,如果我将 a 放入 ,或者如果我使用 CachedImageFastRenderer,它会抛出 NullReferenceException

以下是sn-ps的代码:

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;
}

提前致谢。等待及时回复

【问题讨论】:

    标签: android image xamarin.forms syncfusion


    【解决方案1】:

    我们确认我们能够重现“Image is not being displayed in rotator in android”的问题。我们已记录有关此问题的错误报告,该修复程序将于 2018 年第 4 卷 SP1 可用,预计将于 2019 年 2 月的第一周推出。

    注意:我为 Syncfusion 工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多