Reputation: 729
I am using portable Xamarin.Forms (cross platform) having Android and IOS project.
I am using carousel page so that I can swipe page.
I want only middle content should swipe not whole page. header and footer should not be swipe
You can see in below image that whole page is swiping. I want only middle content to swipe
Please suggest me how to do?
Upvotes: 0
Views: 2819
Reputation: 1123
This is a relatively straightforward refactor using ControlTemplates:
Xamarin.Forms control templates
Presuming you are using MVVM, you would then assign the ControlTemplate to the ContentPage controlTemplate property: e.g.
contentView.ControlTemplate = new SampleControlTemplate()
I personally use GridViews within the ControlTemplate to get a more finite control of the layout. The final output is the area defined as the ContentPresenter will be populated with the layout from your ContentPage (in your case the CarouselPage).
Upvotes: 0
Reputation: 729
I use listview with horizontal swipe instead of coursal page. it works fine
Upvotes: 1
Reputation: 74209
You should look at pre-release version of Xamarin.Forms.CarouselView
for your use-case:
Nuget: `Xamarin.Forms.CarouselView 2.3.0-pre2`
CarouselView
is a replacement for the CarouselPage
. and CarouselPage
will be marked as deprecated sometime in a future release of Xamarin.Forms
.
CarouselView
's are virtualized, a huge memory decrease over CarouselPage
when dealing with more than a couple of pages and can be used like a "control" within a Page
those you can apply header/footer templates to your page and place the CarouselView
in the center.
Source: https://github.com/xamarin/Xamarin.Forms.CarouselView
Upvotes: 1