Forum Xamarin.Forms

sfListView

Ahmad_AbdulAzimAhmad_AbdulAzim Member ✭✭
edited October 2018 in Xamarin.Forms



in main page
i show a list of latest products
the list loaded correctly
but, didn't appear till i tap on it

Best Answer

Answers

  • Anna_MAnna_M Member ✭✭
    Accepted Answer

    @Ahmad_AbdulAzim, Could you share your code then only we find where you have done mistake in your code.

  • this is my list view



    <sfListView:SfListView.ItemTemplate>



                                                <Grid VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Margin="0" Padding="0" >
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="*"/>
                                                        <RowDefinition Height="30"/>
                                                        <RowDefinition Height="5"/>
                                                    </Grid.RowDefinitions>
    
                                                    <ffimageloading:CachedImage  Grid.RowSpan="3"
                                                        HeightRequest="100"
                                                   Aspect="Fill" HorizontalOptions="FillAndExpand"
                                                   VerticalOptions="Fill" Source="http://dt-works.com/amd/oroba/contents/tbads/0/1_azsqcorlrf.jpg">
                                                    </ffimageloading:CachedImage>
    
                                                    <StackLayout Grid.Row="1" HorizontalOptions="Start" 
                                                                 VerticalOptions="Start" 
                                                                 HeightRequest="20" Margin="0" Spacing="0">
                                                        <Frame  Padding="0"  CornerRadius="20"
                                                                VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" 
                                                                BorderColor="Transparent"
                                                                BackgroundColor="{DynamicResource BaseColor}" Margin="0,0,-13,0">
    
                                                            <Controls:CustomLabel Text="{Binding unit_name}" Style="{StaticResource lblstViewUnit}" />
    
                                                        </Frame>
                                                    </StackLayout>
    
    
    
                                                </Grid>
                                            </StackLayout>
    
    
                                            <StackLayout Orientation="Horizontal" HeightRequest="50" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" >
                                                <Controls:CustomLabel  Text="{Binding product_name}"  Style="{StaticResource lbLinkButton}"
                                                                       HorizontalTextAlignment="Center" VerticalTextAlignment="Start"
                                                                       HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"                                                                       
                                                                        LineBreakMode="CharacterWrap" MaxLines="3"/>
                                            </StackLayout>
    
    
                                            <StackLayout Orientation="Horizontal" VerticalOptions="End" HorizontalOptions="FillAndExpand" Spacing="0"
                                                         Margin="2,2,2,5">
                                                <Controls:CustomLabel Text="&#xf291;" Style="{StaticResource lblstViewIcons}"  /> 
    
                                                <Controls:CustomLabel  Text="{Binding price_text}" HorizontalTextAlignment="Center"
                                                                       HorizontalOptions="FillAndExpand"  Margin="0"/>
    
                                                <Controls:CustomLabel Text="&#xe839;" Style="{StaticResource lblstViewIcons}" />
    
                                            </StackLayout>
    
                                        </StackLayout>
                                        <!--<Grid Margin="0">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="15*"/>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="15*"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="20"/>
                                                <RowDefinition Height="100"/>
                                                <RowDefinition Height="*"/>
                                                <RowDefinition Height="30"/>
                                                <RowDefinition Height="30"/>
                                            </Grid.RowDefinitions>
    
    
                                            <StackLayout Grid.Row="4" Grid.Column="1" Orientation="Horizontal">
    
                                                <Controls:CustomLabel  Text="Hd phhhhhhhh" />
                                                <Controls:CustomLabel Text="{Resx:TranslateExtension Text=lbSAR}" />
    
                                            </StackLayout>
    
    
                                        </Grid>-->
                                        <Frame.GestureRecognizers>
                                            <TapGestureRecognizer Tapped="Frame_Tapped" CommandParameter="{Binding .}"/>
                                        </Frame.GestureRecognizers>
                                    </Frame>
                                </DataTemplate>
                            </sfListView:SfListView.ItemTemplate>
                        </sfListView:SfListView>
    

    fill it using API



    this


    await vm.OnLoadLatestProducts(null);
    if (vm.lstLatestProducts != null)
    lstLatest.ItemsSource = vm.lstLatestProducts;

Sign In or Register to comment.