Hello,
Welcome to Microsoft Q&A!
Firstly take a look at Bindable Layouts in Xamarin.Forms .
Bindable layouts enable any layout class that derives from the Layout<T> class to generate its content by binding to a collection of items .
BindableLayout
exposes the attached properties (including ItemsSource ,ItemTemplate) .
The usage is pretty simple
<StackLayout BindableLayout.ItemsSource="{Binding User.TopFollowers}"
Orientation="Horizontal"
...>
<BindableLayout.ItemTemplate>
<DataTemplate>
<controls:CircleImage Source="{Binding}"
Aspect="AspectFill"
WidthRequest="44"
HeightRequest="44"
... />
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
Note : While it's technically possible to attach a bindable layout to any layout class that derives from the Layout<T> class, it's not always practical to do so, particularly for the AbsoluteLayout
, Grid
, and RelativeLayout
classes.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.