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

Listview Binding Label not displaying on iOS Project but working on Android?

$
0
0

Hey i am facing an issue with my current list view which has two labels which display a title and subtitle. i have this working in Android but when i run the iOS project these two labels are not showing. I have added another label to the DataTemplate with the text of Hello World and that is showing on iOS as well as the fontawesome icon. Does anybody know why this is happening?

Here is my XAML:

    `<ListView x:Name="UpcomingJobsList" ItemTapped="UpcomingList_ItemTapped" SeparatorVisibility="Default" HasUnevenRows="False" RowHeight="85">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <custom:CustomViewCell SelectedItemBackgroundColor="Pink">
                                <Grid Padding="20, 20, 20, 20">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="15" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <Label Text=" hello world" TextColor="Black" />
                                    <Label Text="{Binding Destination}" Grid.Column="0" Grid.Row="0" HorizontalTextAlignment="Start" TextColor="#C8C8C8" FontAttributes="Bold" FontSize="12" />
                                    <Label Text="{Binding Name}" Grid.Column="0" Grid.Row="1" HorizontalTextAlignment="Start" TextColor="Black" FontSize="16" FontAttributes="Bold" />
                                    <Label Text="&#xf105;" TextColor="#09C887" VerticalTextAlignment="Center" HorizontalTextAlignment="End" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" FontSize="22">
                                        <Label.FontFamily>
                                            <OnPlatform x:TypeArguments="x:String" Android="fa900.ttf#Font Awesome 5 Free Solid" iOS="Font Awesome 5 Free" />
                                        </Label.FontFamily>
                                    </Label>
                                </Grid>
                            </custom:CustomViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>`

And here is my code behind (List View is just a basic list)

    `public class UpcomingJobsData
        {
            public string Name { get; set; }
            public string Destination { get; set; }
        }

    var jobdata = new List<UpcomingJobsData>();

            jobdata.Add(new UpcomingJobsData()
            {
                Name = "Petstore",
                Destination = "LINCOLN > DERBY"
            });

            jobdata.Add(new UpcomingJobsData()
            {
                Name = "Simple Business Supplies",
                Destination = "LINCOLN > DERBY"
            });

            jobdata.Add(new UpcomingJobsData()
            {
                Name = "DFDS Seaways",
                Destination = "LINCOLN > DERBY"
            });

            UpcomingJobsList.ItemsSource = jobdata;`

Viewing all articles
Browse latest Browse all 89864

Trending Articles



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