We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Horizontal SfListView doesnt appear inside Stacklayout

Thread ID:

Created:

Updated:

Platform:

Replies:

133051 Oct 5,2017 10:50 PM UTC Oct 6,2017 11:02 AM UTC Xamarin.Forms 1
loading
Tags: SfListView
Emil
Asked On October 5, 2017 10:50 PM UTC

  I am trying to display Horizontal Listview within stacklayout using AutoFitMode="Height" but it doesnt appear although I used VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" as advised in the documentation.

I tried also using fix ItemSize as below but still it doesnt appear. How can I solve this problem? 


<StackLayout  x:Name="Main" BackgroundColor="#ADD8E6"  VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"  Orientation="Vertical">
            
            <sfListView:SfListView x:Name="listLanguages"   BackgroundColor="Orange" IsStickyFooter="True"  ItemsSource="{Binding Languages}" SelectionMode="Single"  SelectionGesture="Tap" 
             ItemSpacing="2" AllowSwiping="False"     SelectionBackgroundColor="Yellow"  Orientation="Horizontal"  VerticalOptions="FillAndExpand"
             SelectedItem="{Binding SelectedLanguage, Mode=TwoWay}"  HorizontalOptions="FillAndExpand" >
                <sfListView:SfListView.LayoutManager>
                    <sfListView:LinearLayout />
                </sfListView:SfListView.LayoutManager>
                <sfListView:SfListView.ItemSize>
                    <OnPlatform x:TypeArguments="x:Double">
                        <OnPlatform.Android>
                            <OnIdiom x:TypeArguments="x:Double" Phone="50" Tablet="100" />
                        </OnPlatform.Android>
                        <OnPlatform.iOS>
                            <OnIdiom x:TypeArguments="x:Double" Phone="50" Tablet="100" />
                        </OnPlatform.iOS>
                        <OnPlatform.WinPhone>
                            <OnIdiom x:TypeArguments="x:Double" Phone="50" Tablet="100" Desktop="200" />
                        </OnPlatform.WinPhone>
                    </OnPlatform>
                </sfListView:SfListView.ItemSize>
                <sfListView:SfListView.ItemTemplate>
                    <DataTemplate>

                        <Grid  HeightRequest="50"  ColumnSpacing="0"   InputTransparent="True" >

                            <ffimageloading:CachedImage Aspect="AspectFit" TransparencyEnabled = "false"  Source="{Binding Image}" />
                            <Grid VerticalOptions="End" ColumnSpacing="0" Opacity="0.75" BackgroundColor="#CDCDCD">
                                <Grid.HeightRequest>
                                    <OnPlatform x:TypeArguments="x:Double">
                                        <OnPlatform.WinPhone>
                                            <OnIdiom x:TypeArguments="x:Double" Phone="10" Tablet="20" />
                                        </OnPlatform.WinPhone>
                                        <OnPlatform.Android>
                                            <OnIdiom x:TypeArguments="x:Double" Phone="10" Tablet="20" />
                                        </OnPlatform.Android>
                                        <OnPlatform.iOS>
                                            <OnIdiom x:TypeArguments="x:Double" Phone="10" Tablet="20" />
                                        </OnPlatform.iOS>
                                    </OnPlatform>
                                </Grid.HeightRequest>
                                <Label Text="{Binding name}" TextColor="Black"
                     VerticalTextAlignment="Center"
                     Margin="20,0,0,0"
                     HorizontalTextAlignment="Start">
                                    <Label.FontSize>
                                        <OnPlatform x:TypeArguments="x:Double">
                                            <OnPlatform.WinPhone>
                                                <OnIdiom x:TypeArguments="x:Double" Phone="6" Tablet="8" />
                                            </OnPlatform.WinPhone>
                                            <OnPlatform.Android>
                                                <OnIdiom x:TypeArguments="x:Double" Phone="6" Tablet="8" />
                                            </OnPlatform.Android>
                                            <OnPlatform.iOS>
                                                <OnIdiom x:TypeArguments="x:Double" Phone="6" Tablet="8" />
                                            </OnPlatform.iOS>
                                        </OnPlatform>
                                    </Label.FontSize>
                                </Label>
                            </Grid>
                        </Grid>

                    </DataTemplate>
                </sfListView:SfListView.ItemTemplate>

            </sfListView:SfListView>

Muthu Kumaran Gnanavinayagam [Syncfusion]
Replied On October 6, 2017 11:02 AM UTC

Hi Emil,   
  
We have checked your reported query “SfListView does not load inside StackLayout when AutoFitMode set as ‘Height’” from our side. We have tried to replicate the issue at our end based on the given code example. Unfortunately, the reported issue does not reproduce at our end. In our sample, we have loaded the SfListView in Horizontal orientation inside a StackLayout with AutoFitMode set as ‘Height’ and the list items are loaded as expected.  For your reference, we have attached the working sample link below.   
  
  
If the issue still reproduces at your end, please modify the attached sample and revert with the replication procedure or video link. Also, can you please share the below mentioned details which helps us to analyze the issue better.   
  
-Could you please check whether ViewModel is set as BindingContext for the Page in which the SfListView is loaded?   
-Does the issue reproduce only in particular version of SfListView? (We have verified our sample in v15.3.0.33)   
-Does the issue reproduce only in particular version of Xamarin.Forms?(We have verified our sample in v2.3.4.282)   
  
Regards,   
G.Muthu Kumaran.  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;