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

Android - Problems with Label text binding in a ViewCell DataTemplate

$
0
0

Hi,

here is my xaml code.
The list view is ItemSource is bind to UserData which is a notification property that is declared in my view model. The property is being updated when the server returns the data. The ListView is being updated because the raw appears once the data is loaded but there is nothing displayed in them.
Also when I tap the raw the correct item is being returned so every thing is hooked up the way it should be.

Not sure why the labels are not being displayed though...

Also everything works the way it should on WP.

<ListView
    x:Name="MyListView"
    ItemsSource="{Binding UsersData}">
    <b:Interaction.Behaviors>
      <b:BehaviorCollection>
        <behaviors:OnCommandSelectedItemListViewBehavior Command="{Binding ItemSelectedCommand}" />
      </b:BehaviorCollection>
    </b:Interaction.Behaviors>
    <ListView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
          <StackLayout HorizontalOptions="StartAndExpand" Orientation="Horizontal">
            <Label Text="{Binding Name}" YAlign="Center" />
            <Label Text="{Binding Age}" YAlign="Center" />
          </StackLayout>
        </ViewCell>
      </DataTemplate>
    </ListView.ItemTemplate>
  </ListView>

Many thanks


Viewing all articles
Browse latest Browse all 77050

Trending Articles