2017-05-24 1 views
2

Ich habe Probleme mit dem CarouselView-Steuerelement von AlexRainman. Das Steuerelement wird auf Android, aber nicht auf iOS, ordnungsgemäß angezeigt. Mein Projekt ist ein Xamarin PCL-Projekt für iOS und Android, das derzeit an Visual Studio 2017 für macOS arbeitet. Und dabei stecken geblieben, und ich habe keine Ahnung, wie ich diesen Fehler lösen soll. Jede Hilfe wäre willkommen.CarouselView von AlexRainman nicht auf iOS Rendering, gut auf Android. Xamarin.Forms

Mein Inhalt Seite:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
     x:Class="PelotaJara.BookingUserPage" 
     xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions" 

     > 
    <controls:CarouselViewControl x:Name="carousel" IndicatorsTintColor="Gray" ShowIndicators="True" 
           CurrentPageIndicatorTintColor="Black" Orientation="Horizontal" InterPageSpacing="10" 
           VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" AnimateTransition="true" IsSwipingEnabled="true"> 
     <controls:CarouselViewControl.ItemTemplate> 
      <DataTemplate> 
      <Grid> 
       <Grid.RowDefinitions> 
        <RowDefinition Height="30*" /> 
        <RowDefinition Height="50*" /> 
        <RowDefinition Height="20*" /> 

       </Grid.RowDefinitions> 


        <Image Grid.Row="0" VerticalOptions="Start" HorizontalOptions="CenterAndExpand" Source="{Binding Image}"/> 
        <Label Grid.Row="0" Text="Cancha Iluminada" TextColor="White" HorizontalOptions="Center" VerticalOptions="End"/> 
        <Button Grid.Row="2" Text="Reservar" BackgroundColor="Red" HorizontalOptions="Fill" VerticalOptions="Center" TextColor="White"/> 


      </Grid> 
     </DataTemplate> 
     </controls:CarouselViewControl.ItemTemplate> 
    </controls:CarouselViewControl> 

Code-Behind:

[XamlCompilation(XamlCompilationOptions.Compile)] 
public partial class BookingUserPage : ContentPage 
{ 
    ObservableCollection<CarouselModel> model { get; set; } 
    public BookingUserPage() 
    { 
     InitializeComponent(); 



     model = new ObservableCollection<CarouselModel>(); 

     carousel.ItemsSource = model; 

     model.Add(new CarouselModel("http://seattlerats.org/wp-content/uploads/2015/03/Soccer-Field-Night.jpg")); 
     model.Add(new CarouselModel("http://seattlerats.org/wp-content/uploads/2015/03/Soccer-Field-Night.jpg")); 
     model.Add(new CarouselModel("http://seattlerats.org/wp-content/uploads/2015/03/Soccer-Field-Night.jpg")); 




    } 



} 

public class CarouselModel 
{ 
    public CarouselModel(string imageString) 
    { 
     Image = imageString; 
    } 
    private string _image; 
    public string Image 
    { 
     get { return _image; } 
     set { _image = value; } 
    } 
} 

Die Appdelegate.cs:

 public override bool FinishedLaunching(UIApplication app, NSDictionary options) 
    { 


     ServicePointManager 
      .ServerCertificateValidationCallback += 
      (sender, cert, chain, sslPolicyErrors) => true; 


     global::Xamarin.Forms.Forms.Init(); 
     LoadApplication(new App()); 

     CarouselViewRenderer.Init(); 

     return base.FinishedLaunching(app, options); 
    } 

Und schließlich meine MainActivity.cs :

[Activity(Label = "PelotaJara", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 
{ 
    protected override void OnCreate(Bundle bundle) 
    { 

     ServicePointManager 
.ServerCertificateValidationCallback += 
(sender, cert, chain, sslPolicyErrors) => true; 

     TabLayoutResource = Resource.Layout.Tabbar; 
     ToolbarResource = Resource.Layout.Toolbar; 

     base.OnCreate(bundle); 

     global::Xamarin.Forms.Forms.Init(this, bundle); 
     CarouselViewRenderer.Init(); 

     LoadApplication(new App()); 
    } 
} 
+1

können Sie ein Problem auf GitHb öffnen –

+0

Was ist das Problem, das Sie auf iOS erleben? – AXE

+0

@ user3096081 hast du irgendeine Lösung gefunden. – Kishore

Antwort

0

Mein Problem nicht genau sein kann, was Sie haben, aber hier, wie ich es gelöst: es funktionierte auf Version 4.4 CarouselView.FormsPlugin in Ordnung. 1 und Xamarin Formen 2,3 ... funktioniert gut aktualisiert die Karussellansicht zu 4.4.3 iOS-Pausen Android funktioniert gut, ich habe ein Problem auf Github eingereicht und scheint zu lösen, also versuchen Sie es auf die neueste Version und Xamarin Formen zu aktualisieren 2.4 .0 sollte funktionieren. Hier ist das Problem auf GitHub: https://github.com/alexrainman/CarouselView/issues/210

Verwandte Themen