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

MVVM Binding Issues

$
0
0

Hello all,

I am having difficulty with the data bindings with xamarin and I was hoping someone might be able to see what I am doing wrong.

First created this in my resources

        <DataTemplate x:Key="tileTemplate">
            <Grid x:Name="gridTile" WidthRequest="90" HeightRequest="90" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" BackgroundColor="Aqua">
                <StackLayout>
                    <Grid BackgroundColor="{Binding Color}">
                        <!---<Image Source="{Binding Image}" IsVisible="{Binding IsVisible}" Height="70" Width="70" HorizontalOptions="Center"/>-->
                    </Grid>
                    <Grid HeightRequest="20" WidthRequest="90">
                        <StackLayout IsVisible="{Binding IsVisible}" BackgroundColor="Gray">
                            <TextCell Text="{Binding Text}" HeightRequest="20" TextColor="White" HorizontalOptions="CenterAndExpand"/>
                        </StackLayout>
                    </Grid>
                </StackLayout>
            </Grid>
        </DataTemplate>

In the constructor I have this.BindingContext = new TileBoardViewModel (); and in the same view as above I added

(using the gridview class from the xlab package)

        <controls:GridView
                x:Name="TileBoard" 
                HeightRequest="90"
                HorizontalOptions="CenterAndExpand"
                VerticalOptions="Center"                
                ItemsSource="{Binding TileTimes}" 
                ItemTemplate="{StaticResource tileTemplate}"/>

My observable collection of tiles gets populated but it doesn't show up in my view :(.

Is there something that I am missing or not getting?

Thanks for any help!!


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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