0
votes

I am trying to build Xaml for Xamarin , I am able to get the UI But the label is not getting binded. (Android Platform)

Also tried Text="{Binding Name}" for label. But not getting any labels rendered. Do i need to write up any additional code ?

<ContentPage.Content>
   <ListView SelectedItem="{Binding SelectedResult}" x:Name="listview1" ItemsSource="{Binding QueryResults}">
  <ListView.ItemTemplate>
  <DataTemplate>
      <ViewCell>

            <Frame Padding="0,0,0,10">
          <Frame.Content>
            <Frame Padding="15,15,15,15"  HeightRequest="36" OutlineColor="Aqua" BackgroundColor="Blue">
              <Frame.Content>
                <StackLayout Padding="20,0,0,0"  Orientation="Horizontal" HorizontalOptions="StartAndExpand">
                  <Label Text="label text for test" TextColor="Yellow">

                  </Label>
                  </StackLayout>

              </Frame.Content>

            </Frame>
          </Frame.Content>

        </Frame>

    </ViewCell>
  </DataTemplate>
</ListView.ItemTemplate>
1
Could you please some of the code-behind? Are there any items in your list? - Gerald Versluis
Yes i do have items in list. - chekuri raju
I'm sorry but I don't think anyone can help you any further if you don't post any code that is filling the list and showing the objects you are using. - Gerald Versluis
Are you setting the BindingContext of the page in the code behind to your object that contains the SelectedResult and QueryResults properties? - SmartyP

1 Answers

1
votes

It worked for me. Here is the code: `

<Frame Padding="15,15,15,15"  HeightRequest="36" OutlineColor="Aqua" BackgroundColor="Blue">
                              <Frame.Content>
                                <StackLayout Padding="20,0,0,0"  Orientation="Horizontal" HorizontalOptions="StartAndExpand">
                                  <Label Text="{Binding Name}" TextColor="Yellow">
                                  </Label>
                                  </StackLayout>
                              </Frame.Content>
                            </Frame>

`

There was frame inside frame so it was overlapping.

Hope this helps!

Even though very late reply after 3 months :p