Forum Xamarin.Forms

ListView not displaying text

kvijurkvijur Member ✭✭

Hi,

In my page list view content is not displayed, but click event is working, below is the code

            <ListView   BindingContext="Menu_items"
                    RowHeight="60" x:Name="li_menu"   ItemSelected="li_menu_ItemTapped">
                <ListView.ItemTemplate >
                    <DataTemplate>
                        <ViewCell >
                            <ViewCell.View>
                                <StackLayout Orientation="Horizontal" Margin="10,10,10,10" VerticalOptions="Center">
                                <Frame CornerRadius="30" HeightRequest="40" WidthRequest="40" HorizontalOptions="Center" VerticalOptions="Center"   Padding="0"  IsClippedToBounds="True">
                                    <Image Source="{Binding ImageUrl}" HorizontalOptions="Center"  VerticalOptions="Center" HeightRequest="40" WidthRequest="40"/>
                                </Frame>
                                <Label Text="{Binding Name}" VerticalTextAlignment="Center"    FontSize="14" FontAttributes="Bold"/>
                                <Label   VerticalTextAlignment="Center"   Margin="10" HorizontalOptions="EndAndExpand" />
                            </StackLayout>
                                </ViewCell.View>
                        </ViewCell>

                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>

// Code
List Menu_items = new List();
int cnt = doc.GetElementsByTagName("id").Count;
for (int i = 0; i < cnt; i++)
{
Menu_items.Add(new MenuItems
{
Name =CheckXMLNode(doc.GetElementsByTagName("menu_name")[i]),
Id = CheckXMLNode(doc.GetElementsByTagName("id")[i]),
ImageUrl = App.api_url + "/menuicon/" + CheckXMLNode(doc.GetElementsByTagName("id")[i]).Remove(0, 1) + ".png",
New = CheckXMLNode(doc.GetElementsByTagName("display_count")[i]),
PageName = CheckXMLNode(doc.GetElementsByTagName("page_name")[i])
});
}
li_menu.ItemsSource = Menu_items;
BindingContext = this;
li_menu.HasUnevenRows = true;

Tagged:

Posts

  • kvijurkvijur Member ✭✭

    Screen list with rows but no data

  • kvijurkvijur Member ✭✭

    instead of

Sign In or Register to comment.