I have a large empty space that is created when I add a list to SfAccordion.

Hello ... I have a page with SfAccordion and each item of this component contains a list which can be empty but when I unroll SfAccordion there is a large empty space the size doesn't fit the content even when the list is empty. How do I remove this empty space ? 
Thanks

1 Reply

SS SaiGanesh Sakthivel Syncfusion Team February 25, 2020 11:35 AM UTC

Hi Emmanuel, 
 
Thank you for using syncfusion product. 
 
We checked the reported query “I have a large empty space that is created when I add a list to SfAccordion” from our end. You can achieve your requirement by setting the customized height(Based on the content) to HeightRequest of the parent (grid) element in Accordion content. 
 
Code snippet XAML: Binding CutsomHeight property to HeightRequest of the parent element. 
<syncfusion:AccordionItem.Content> 
    <Grid HeightRequest="{Binding CustomHeight}"> 
       . . . . .  
    </Grid> 
</syncfusion:AccordionItem.Content> 
 
Code snippet C# : CustomHeight calculation. View Model Class  
public class ItemInfoRepository 
{ 
public ObservableCollection<ItemInfo> Info { get; set; } 
public ItemInfoRepository() 
{ 
    Info = new ObservableCollection<ItemInfo> 
    { 
        new ItemInfo() { Name = "Veggie burger", Description = "Veggie burger, garden burger, or tofu burger uses a meat analogue, a meat substitute such as tofu, textured vegetable protein, seitan (wheat gluten), Quorn, beans, grains or an assortment of vegetables, which are ground up and formed into patties.", ListViewHeight = 100 }, 
        new ItemInfo() { Name = "Barbecue burger", Description = "", ListViewHeight = 0 }, 
        new ItemInfo() { Name = "Chili burger", Description = "Consists of a hamburger, with the patty topped with chili con carne.", ListViewHeight = 100 } 
    }; 
} 
 
Model Class 
public class ItemInfo : INotifyPropertyChanged 
{ 
private double listViewHeight; 
public double ListViewHeight 
{ 
    get { return listViewHeight; } 
    set 
    { 
        listViewHeight = value; 
        OnPropertyChanged("ListViewHeight"); 
    } 
} 
 
please let us know if you would require further assistance. 
 
Regards, 
SaiGanesh Sakthivel 


Loader.
Up arrow icon