I've been trying to figure out what is happening and I think it might be a bug. Only on iOS, when I try to populate a SfListView with SfAccordions, and SfListView.AutoFitMode = DynamicHeight, the ListItems do not populate. I made sure to check during debug. The item count returns 0 even if the ItemSource contains objects in the binding.
If I set the SfListVIew.AutoFitMode = None or Height then the items show, but since they're not dynamic the heights don't change when the Accordions expand. Any help would be appreciated.
<sfLv:SfListView x:Name="accordionCollectionView"
VerticalOptions="FillAndExpand"
AutoFitMode="DynamicHeight"
SelectionMode="None"
ItemsSource="{Binding CurrentOnSiteHours}">
<sfLv:SfListView.ItemTemplate>
<DataTemplate>
<StackLayout VerticalOptions="FillAndExpand">
<syncfusion:SfAccordion x:Name="onSiteHourAccordion"
DynamicSizeMode="Content"
ExpandMode="SingleOrNone"
VerticalOptions="FillAndExpand">
<syncfusion:AccordionItem IsExpanded="False">
<syncfusion:AccordionItem.Header>
<Grid BackgroundColor="{DynamicResource GridSecondaryBackground}">
<Label HeightRequest="50"
Text="{Binding UserOnJob.UserName, Mode=TwoWay}"
TextColor="{DynamicResource MainTextColor}"
VerticalTextAlignment="Center" />
</Grid>
</syncfusion:AccordionItem.Header>
<syncfusion:AccordionItem.Content>
all of my content code
</syncfusion:AccordionItem.Content/>
I should also say that my reason of not using a BindableLayout to display multiple Accordions is because I need the list to dynamically add and remove items from the list. An SfAccordion as a BindableLayout also has some issues on iOS. I can only add items to the view, but when items are taken away from the ItemSource the UI doesn't change. So then the items just end up concatenating to the end without removing old ones.
|
<sflistview:SfListView x:Name="listView" AutoFitMode="DynamicHeight" ItemsSource="{Binding ContactsInfo}" VerticalOptions="FillAndExpand">
<sflistview:SfListView.ItemTemplate>
<DataTemplate>
<Grid>
<acc:SfAccordion x:Name="expander" HeaderIconPosition="None" DynamicSizeMode="Content" ExpandMode="SingleOrNone">
<acc:AccordionItem IsExpanded="{Binding IsExpanded, Mode=TwoWay}">
<acc:AccordionItem.Header>
...
</acc:AccordionItem.Header>
<acc:AccordionItem.Content>
...
</acc:AccordionItem.Content>
</acc:AccordionItem>
</acc:SfAccordion>
</Grid>
</DataTemplate>
</sflistview:SfListView.ItemTemplate>
</sflistview:SfListView> |