The View

Based on the view shown before, the syntax will be quite complex actually.

We need to call ListView, then assign the itemTemplate with each ViewCell. For each cell, we create a stacklayout to show TaskName and Priority.

<ContentPage.Content>
    <StackLayout Padding="30">
        <ListView x:Name="ToDoList"
                  ItemTapped="OnSelected"
                  ItemsSource="{Binding ToDoItems}">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <ViewCell.View>
                            <StackLayout Padding="5" Spacing="1">
                                <Label x:Name="TaskNameDisplay"
                                       Text="{Binding TaskName}"
                                       FontSize="12"
                                       TextColor="Red" />
                                <StackLayout Orientation="Horizontal">
                                    <Label Text="Priority: " FontSize="10" />
                                    <Label Text="{Binding Priority}" FontSize="10"/>
                                </StackLayout>
                            </StackLayout>
                        </ViewCell.View>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>
</ContentPage.Content>

results matching ""

    No results matching ""