My list isn't rendering correctly my items!

    private async void LoadMoreTickets()
    {
        listView.IsRefreshing = true;

        var view = (ViewTicket)pickerViews.SelectedItem;
        pageNumber++;

        var ticketsList = await Api.GetTicketByView(view.Id, pageNumber);

        //Tickets its a ObservableCollection and i dnt need to set the source again..
        foreach (var item in ticketsList)
        {
             Tickets.Add(item);
        }

        listView.IsRefreshing = false;
    }

I'm already making the method async, but my list doesn't render correctly, some fields dsnt appears...
someone have any idea why ? D:

Best Answer

  • WarwenczackWarwenczack BRMember ✭✭
    Accepted Answer

    Forget, the informations are there, but its white!

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    you should post your xaml, your Model, a picture that show your problem....

  • WarwenczackWarwenczack BRMember ✭✭
    edited November 10

    XAML->



    <ListView.ItemTemplate>


    <ViewCell.View>


                                                        <Grid.RowDefinitions>
                                                            <RowDefinition Height="25"/>
                                                            <RowDefinition Height="25"/>
                                                            <RowDefinition Height="33"/>
                                                        </Grid.RowDefinitions>
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition Width="*"/>
                                                            <ColumnDefinition Width="*"/>
                                                            <ColumnDefinition Width="*"/>
                                                            <ColumnDefinition Width="*"/>
                                                        </Grid.ColumnDefinitions>
    
                                                        <StackLayout Grid.RowSpan="3" Grid.ColumnSpan="1" Grid.Column="0" Grid.Row="0">
                                                            <local:RoundedImage IsVisible="{Binding ShowPicture}" HorizontalOptions="CenterAndExpand" WidthRequest="64" HeightRequest="64" VerticalOptions="CenterAndExpand" Source="{Binding PathPicture}"/>
    
                                                            <Grid HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" IsVisible="{Binding ShowName}">
                                                                <local:RoundedImage HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" WidthRequest="64" HeightRequest="64" Grid.Row="0" Grid.Column="0"/>
                                                                <Label Grid.Row="0" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Grid.Column="0" TextColor="Black" Text="{Binding TwoCharName}" FontSize="25"/>
                                                            </Grid>
    
                                                        </StackLayout>
    
                                                        <StackLayout Grid.ColumnSpan="3" Grid.Column="1" Grid.Row="0">
                                                            <Label VerticalOptions="CenterAndExpand" HorizontalOptions="Start" FontAttributes="Bold" FontSize="13" Text="{Binding CreatedBy}"/>
                                                        </StackLayout>
    
                                                        <StackLayout Grid.ColumnSpan="3" Grid.Column="1" Margin="0,-20,0,0" Grid.Row="1">
                                                            <Label VerticalOptions="CenterAndExpand" FontSize="Micro" HorizontalOptions="Start" Text="{Binding Owner}"/>
                                                        </StackLayout>
    
                                                        <StackLayout Grid.ColumnSpan="3" Grid.Column="1" Margin="0,-20,0,0" Grid.Row="2">
                                                            <Label VerticalOptions="CenterAndExpand" FontSize="12" HorizontalOptions="Start" Text="{Binding Subject}"/>
                                                        </StackLayout>
    
                                                        <StackLayout Grid.ColumnSpan="1" Orientation="Horizontal" Grid.Column="4" Grid.Row="0" Margin="0,0,5,0">
                                                            <Label VerticalOptions="CenterAndExpand" FontSize="11" HorizontalOptions="CenterAndExpand" Text="{Binding CreatedDate, StringFormat='{0:dd/MM}'}"/>
                                                            <StackLayout WidthRequest="8" HeightRequest="8" IsVisible="{Binding ShowUrgency}" BackgroundColor="{Binding UrgencyColor}" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/>
                                                        </StackLayout>
    
                                                        <StackLayout Grid.ColumnSpan="1" Grid.Column="4" Grid.Row="1" Margin="0,-20,5,0">
                                                            <Frame HasShadow="False" Padding="1" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand" BackgroundColor="{Binding TypeColor}" CornerRadius="8">
                                                                <Label TextColor="White" VerticalOptions="CenterAndExpand" FontSize="10" HorizontalOptions="CenterAndExpand" Text="{Binding Number}"/>
                                                            </Frame>
                                                        </StackLayout>
    
                                                        <StackLayout Grid.ColumnSpan="1" Grid.Column="4" Grid.Row="2" Margin="0,-20,5,0">
                                                            <Label VerticalOptions="CenterAndExpand" FontSize="Micro" HorizontalOptions="CenterAndExpand" Text="{Binding Status}"/>
                                                        </StackLayout>
                                                    </Grid>
                                                </Frame>
                                                <BoxView HeightRequest="1" HorizontalOptions="FillAndExpand" BackgroundColor="#dee3e7"/>
                                            </StackLayout>
                                        </ViewCell.View>
                                    </ViewCell>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>
                    </StackLayout>
                </ScrollView>
    
  • WarwenczackWarwenczack BRMember ✭✭


    pic

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    The "Model"?

  • WarwenczackWarwenczack BRMember ✭✭
    public static async Task<List<TicketList>> GetTicketByView(int viewId, int pageNumber = 0)
            {
                try
                {
                    string url = DefaultUrl + "GetTicketByView/" + Settings.GuidApi + "/" + viewId + "/" + pageNumber + "/" + Settings.PersonId;
                    var response = await Client.GetStringAsync(url);
                    var tickets = JsonConvert.DeserializeObject<List<TicketList>>(response);
    
                    return tickets;
                }
                catch (Exception)
                {
                    throw;
                }
            }
    
  • WarwenczackWarwenczack BRMember ✭✭
    Accepted Answer

    Forget, the informations are there, but its white!

Sign In or Register to comment.