- Home
- Forum
- Xamarin.Forms
- Auto height doesn't working when I using sfChips in items
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="Start" Grid.Row="0" Grid.Column="0">
<Label Grid.Row="1" Text="{Binding Name}"/>
<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="Start" Grid.Row="0" Grid.Column="0">
<Label Grid.Row="1" Text="{Binding Name}"/>
<Label Grid.Row="1" Text="{Binding CategoryName}" />
<Label Grid.Row="1" Text="{Binding TypeName}"/>
<Label Grid.Row="1" Text="{Binding Description}"/>
<Label Grid.Row="1" Text="{Binding Price}"/>
</StackLayout>
<StackLayout Orientation="Vertical" VerticalOptions="Start" Grid.Row="1" Grid.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>
<StackLayout Orientation="Vertical" VerticalOptions="Start" Grid.Row="1" Grid.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?
SIGN IN To post a reply.
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.
Sample Link : http://www.syncfusion.com/downloads/support/directtrac/142451/ze/ListViewsample-640845133
|
<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
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
CE Cepega
- Feb 5, 2019 07:02 AM UTC
- Feb 6, 2019 12:15 PM UTC