Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Add BindableLayout to a Grid

$
0
0

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


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>