Add BindableLayout to a Grid

JassimRahmaJassimRahma USMember ✭✭✭✭

Hi,

I am using below to Bin data to a StackLayout but i was woundering is it possible to add a BindableLayout to the Grid directly instead of keeping it inside a Bindable StackLayout

<StackLayout x:Name="TempGrid" Grid.Row="2">
<BindableLayout.ItemTemplate>
    <DataTemplate>
        <Grid HorizontalOptions="Center" VerticalOptions="Center">
            <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <StackLayout Grid.Row="0" HorizontalOptions="FillAndExpand">
                <Label Text="{Binding weather_date, StringFormat='{}{0:HH:mm}'}" Margin="0,0,0,10" FontAttributes="Bold" />
                <BoxView HeightRequest="1" BackgroundColor="LightGray" HorizontalOptions="FillAndExpand" Margin="0,0,0,10" />
            </StackLayout>
            <FFImageLoading:CachedImage Grid.Row="1" Margin="0,0,0,10" Source="{Binding weather_icon}" HorizontalOptions="Center" VerticalOptions="Start" WidthRequest="45" HeightRequest="45" DownsampleToViewSize="true" FadeAnimationForCachedImages="True" FadeAnimationDuration="100">
            </FFImageLoading:CachedImage>
            <Label x:Name="LabelHourlyTemperature" Grid.Row="2" Margin="0,0,0,10" Text="{Binding Temperature.Value, StringFormat='{0:0}°C'}" HorizontalOptions="Center" FontSize="Large" FontAttributes="Bold" />
            <Label Grid.Row="3" Text="{Binding IconPhrase}" Margin="0,0,0,10" HorizontalOptions="Center" FontSize="Medium" />
        </Grid>
    </DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>

Thanks,
Jassim

Sign In or Register to comment.