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. Image for the cookie policy date
close icon

Auto height doesn't working when I using sfChips in items

Hello.
I have sfListView where I add shChipsGroup in items.
My XAML:
 <xForms:SfListView ItemsSource="{Binding Items}" AutoFitMode="Height">
                <xForms:SfListView.ItemTemplate>
                    <DataTemplate>
                        <Grid RowSpacing="0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="1" />
                            </Grid.RowDefinitions>
                            <Grid RowSpacing="0" Padding="8,0,8,10">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="10" />
                                </Grid.ColumnDefinitions>
                                <StackLayout Orientation="Vertical" VerticalOptions="StartGrid.Row="0Grid.Column="0">
                                    <Label 
Grid.Row="1Text="{Binding Name}"/>
                                    <Label Grid.Row="1Text="{Binding CategoryName}" />
                                    <Label Grid.Row="1Text="{Binding TypeName}"/> 
                                    <Label Grid.Row="1Text="{Binding Description}"/>
                                    <Label Grid.Row="1Text="{Binding Price}"/>
                                </StackLayout>
                                <StackLayout Orientation="VerticalVerticalOptions="Start  Grid.Row="1Grid.ColumnSpan="2"> 
                                    <buttons:SfChipGroup Grid.Row="1"
                                                     ItemsSource="{Binding Ingredients}"
                                                     ChipPadding="8,8,0,0"
                                                     Type="Action"
                                                     DisplayMemberPath="Name">
                                    <buttons:SfChipGroup.ChipLayout>
                                        <FlexLayout HorizontalOptions="Start"
                                                    VerticalOptions="Start"
                                                    FlexLayout.AlignSelf="Start"
                                                    Direction="Row"
                                                    Wrap="Wrap"
                                                    JustifyContent="Start"
                                                    AlignContent="Start"
                                                    AlignItems="Start">
                                            </FlexLayout>
                                    </buttons:SfChipGroup.ChipLayout>
                                </buttons:SfChipGroup>
                                </StackLayout>
                            </Grid>
                            <BoxView Grid.Row="2"
                                     HeightRequest="1"
                                     Opacity="0.75"
                                     BackgroundColor="#CECECE" />
                        </Grid>
                    </DataTemplate>
                </xForms:SfListView.ItemTemplate>
            </xForms:SfListView>


When in FlexLayout I set Wrap="Wrap" my each row height has calculated is not correct. 
Screen:

But when I change Wrap to "NoWrap" - the height is correct:

Can you help me?



3 Replies

CE Cepega February 5, 2019 11:57 AM UTC

The same problem in iOS and Android devices.
I tried add 
Loaded="listView_Loaded" to ListView where I called listView.RefreshListViewItem(), but it doesn't help me.


GP Gnana Priya Namasivayam Syncfusion Team February 5, 2019 04:32 PM UTC

Hi Sergey, 
 
Thanks for using Syncfusion product. 
 
We have checked reported the query from our side and could able to reproduce the issue. We are currently validating the reported query and will update further details on February 5, 2019. We will appreciate your patience until then. 
 
Regards, 
Gnana Priya N 



GP Gnana Priya Namasivayam Syncfusion Team February 6, 2019 12:15 PM UTC

Hi Sergey, 
 
We have checked the reported query from our side. We would like to know that default ItemHeight value of SfChip is double.NAN. So, we need to use ItemHeight for the SfChipGroup. So that, it get adjusted correctly to the view inside the ListView ItemTemplate. We have attached the modified sample for your reference, please find the sample from following. 
 
 
 
<StackLayout> 
   <buttons:SfChipGroup Grid.Row="1" ItemHeight="40" ItemsSource="{Binding Employees}" 
                        ChipPadding="8,8,0,0" 
                        Type="Action" 
                        DisplayMemberPath="Name"> 
       </buttons:SfChipGroup> 
</StackLayout> 
 
 
 
Regards, 
Gnana Priya N 


Loader.
Live Chat Icon For mobile
Up arrow icon