Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle CarouselView #26

Open
akamud opened this issue Feb 1, 2021 · 0 comments
Open

Handle CarouselView #26

akamud opened this issue Feb 1, 2021 · 0 comments

Comments

@akamud
Copy link
Owner

akamud commented Feb 1, 2021

It will be needed to handle the collection filling manually, since it is only done in the platform code.
https://github.com/xamarin/Xamarin.Forms/blob/5.0.0/Xamarin.Forms.Platform.iOS/CollectionView/TemplatedCell.cs

            if (view is CollectionView cv)
            {
                foreach (var item in cv.ItemsSource)
                {
// Must choose the datatemplate first
                    var temp = cv.ItemTemplate.CreateContent() as View;
                    temp.BindingContext = item;
                    cv.AddLogicalChild(temp);
                }
                var logicalChildren = cv.GetType().GetProperty("LogicalChildrenInternal", BindingFlags.Instance
                        | BindingFlags.NonPublic)
                    .GetValue(cv) as ReadOnlyCollection<Element>;
            }

Selecting data template:
https://github.com/xamarin/Xamarin.Forms/blob/5.0.0/Xamarin.Forms.Platform.iOS/CollectionView/TemplatedCell.cs#L99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant