You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
Je vous contacte car j'ai un bug dans mon programme que j'ai pu reproduire. J'ai un carouselview imbriqué dans un autre. Le défilement à l'intérieur ne fonctionnait pas alors j'ai désactivé celui du parent et je l'ai fait manuellement. Le problème ne se pose pas là.
Quand on défile au niveau du carousel parent, tout va bien. Quand on défile au niveau du carousel enfant, tout va bien.
Le soucis se pose quand on essaie d'ajouter un nouvel item dans la collection du parent.
using MathomicsEnseignant.Test.ViewModels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MathomicsEnseignant.Views.SubViews
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TestPage : ContentPage
{
public TestPage()
{
InitializeComponent();
this.BindingContext = new TestPageViewModel();
}
public void SwipeLeft(object sender, EventArgs e)
{
ObservableCollection<string> collection = (ObservableCollection<string>)this._carousel.ItemsSource;
int currentIndex = collection.IndexOf((string)_carousel.CurrentItem);
int nextIndex = currentIndex - 1;
if (nextIndex < 0) nextIndex = collection.Count - 1;
_carousel.ScrollTo(nextIndex);
_carousel.Position = nextIndex;
_carousel.CurrentItem = collection[nextIndex];
}
public void SwipeRight(object sender, EventArgs e)
{
ObservableCollection<string> collection = (ObservableCollection<string>)this._carousel.ItemsSource;
int currentIndex = collection.IndexOf((string)_carousel.CurrentItem);
int nextIndex = currentIndex + 1;
if (nextIndex >= collection.Count) nextIndex = 0;
_carousel.ScrollTo(nextIndex);
_carousel.Position = nextIndex;
_carousel.CurrentItem = collection[nextIndex];
}
}
}
TestPageViewModel:
using MathomicsEnseignant.ViewModels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using Xamarin.Forms;
namespace MathomicsEnseignant.Test.ViewModels
{
public class TestPageViewModel: BaseViewModel
{
public ObservableCollection<String> Items { get; set; } = new ObservableCollection<string>();
public Command CommandAddItem { get; set; }
public TestPageViewModel()
{
CommandAddItem = new Command(AddItem);
for (int i = 0; i < 5; i++) this.Items.Add(this.Items.Count + "");
}
public void AddItem()
{
this.Items.Add(this.Items.Count + "");
}
}
}
using MathomicsEnseignant.Test.ViewModels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace MathomicsEnseignant.Views.SubViews
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Inside : ContentView
{
public Inside()
{
InitializeComponent();
this.BindingContext = new InsidePageViewModel();
}
}
}
InsidePageViewModel:
using MathomicsEnseignant.ViewModels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using Xamarin.Forms;
namespace MathomicsEnseignant.Test.ViewModels
{
public class InsidePageViewModel: BaseViewModel
{
public ObservableCollection<String> Items2 { get; set; } = new ObservableCollection<string>();
public InsidePageViewModel()
{
for (int i = 0; i < 5; i++) this.Items2.Add("Inside " + this.Items2.Count + "");
}
}
}
Steps to Reproduce
Faite défiler les éléments du parents avec les boutons "left" and "right"
Faite défiler le carousel enfant.
Cliquez sur AddItem (bouton central)
Expected Behavior
Le dernier Item doit se rajouter à la fin du carousel view. On garde la même view et le carouselview à l'intérieur de change pas.
Actual Behavior
On reste sur la même page, mais le carouselview semble s'être déplacé sur un autre item du parent.
Basic Information
Je lance l'application sur un emulateur android pixel_5 api_30
Build Logs
No log
Screenshots
Pas de capture d'écran, la description suffit.
The text was updated successfully, but these errors were encountered:
Description
Bonjour,
Je vous contacte car j'ai un bug dans mon programme que j'ai pu reproduire. J'ai un carouselview imbriqué dans un autre. Le défilement à l'intérieur ne fonctionnait pas alors j'ai désactivé celui du parent et je l'ai fait manuellement. Le problème ne se pose pas là.
Quand on défile au niveau du carousel parent, tout va bien. Quand on défile au niveau du carousel enfant, tout va bien.
Le soucis se pose quand on essaie d'ajouter un nouvel item dans la collection du parent.
Voici mon code. Très simple à reproduire 👍
TestPage.xaml:
TestPage.xaml.cs
TestPageViewModel:
Inside.xaml:
Inside.xaml.cs:
InsidePageViewModel:
Steps to Reproduce
Expected Behavior
Le dernier Item doit se rajouter à la fin du carousel view. On garde la même view et le carouselview à l'intérieur de change pas.
Actual Behavior
On reste sur la même page, mais le carouselview semble s'être déplacé sur un autre item du parent.
Basic Information
Je lance l'application sur un emulateur android pixel_5 api_30
Build Logs
No log
Screenshots
Pas de capture d'écran, la description suffit.
The text was updated successfully, but these errors were encountered: