Adding scroll control to the CarouselView
Add a new file into the Controls
folder called CarouselScroll.cs
and implement the first part as follows:
public class CarouselScroll : ScrollView { #region Private Properties private CarouselLayout _carouselLayout; #endregion public DataTemplate ItemTemplate { set { _carouselLayout.ItemTemplate = value; } } public CarouselScroll() { Orientation = ScrollOrientation.Horizontal; _carouselLayout = new CarouselLayout(); Content = _carouselLayout; } }
The CarouselScroll
will inherit the ScrollView
object as this will be the bounding view for the CarouselLayout
. We are also going to create a DataTemplate
variable for setting the DataTemplate
object inside the CarouselLayout
. Then, in the constructor, we instantiate ...
Get Xamarin Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.