简体   繁体   English

Xamarin Forms - 绑定在 CarouselView 中动态创建的整个 PageLayout

[英]Xamarin Forms - Bind a whole PageLayout created dynamically inside CarouselView

I'm having issues with rather simple operation, but for the life of me I can't figure it out.我遇到了相当简单的操作问题,但对于我的生活,我无法弄清楚。 I am looking to incorporate 7 pages into one CarouselView.我希望将 7 页合并到一个 CarouselView 中。 The idea is to have 7 completeley different layouts, so I cannot use ItemTemplate (simply I'll have to do way too many operations with them to get it to work).这个想法是有 7 种完全不同的布局,所以我不能使用 ItemTemplate (只是我必须对它们进行太多操作才能让它工作)。 Now I have an idea to use DataTemplate or return a build ContentPage and populate list that way, then display it inside my CarouselView.现在我有了使用 DataTemplate 或返回构建 ContentPage 并以这种方式填充列表的想法,然后将其显示在我的 CarouselView 中。 I have created a ViewModel creating the proper stacklayout, but I can't bind it to be displayed in xaml.我创建了一个 ViewModel,创建了正确的堆栈布局,但我无法将其绑定到 xaml 中显示。 I would be thankful for any guidance!我会感谢任何指导!

to all who need to bind a whole stack layout/frame or content view inside a carousel view - it can only be done by building a datatemplate resource within your xaml layer, then combining it as an array of object, then setting the itemsource binding in your carousel view!对于所有需要在轮播视图中绑定整个堆栈布局/框架或内容视图的人 - 只能通过在 xaml 层中构建数据模板资源,然后将其组合为 object 数组,然后将 itemsource 绑定设置为你的轮播视图!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM