Answer the question
In order to leave comments, you need to log in
How to make a list in xaml?
<corelayouts:CarouselViewDots
BindingContext="{Binding Path=.}"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
DotColor="White"
DotSize="6"
ScrollToIndex="{Binding ScrollToIndex, Mode=TwoWay}">
<corelayouts:CarouselViewDots.CarouselViews>
<View> // Здесь предполагается список из вьюх для будущих слайдов
<citem:NewsCarouselView/>
</View>
</corelayouts:CarouselViewDots.CarouselViews>
</corelayouts:CarouselViewDots>
private IEnumerable<View> _carouselViews;
public IEnumerable<View> CarouselViews
{
get { return _carouselViews; }
set
{
_carouselViews = value;
}
}
Answer the question
In order to leave comments, you need to log in
If you use the control from this article www.maiersoft.de/blog/creating-a-xamarin-forms-car...
Use ItemTemplate
default property + ContentView control:
<corelayouts:CarouselViewDots.ItemTemplate>
<DataTemplate>
<ContentView Content="{Binding .}"/> // биндим View из коллекции
</DataTemplate>
</corelayouts:CarouselViewDots.ItemTemplate>
ItemTemplate
that works internally like this:foreach (var item in ItemsSource) {
var view = (View)ItemTemplate.CreateContent();
var bindableObject = view as BindableObject;
if (bindableObject != null)
bindableObject.BindingContext = item;
_stack.Children.Add (view);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question