This is a migrated thread and some comments may be shown as answers.

Add Items Dynamically

1 Answer 207 Views
Accordion
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 18 Feb 2021, 11:35 AM

Hi Support,

We are currently evaluating Telerik UI for Xamarin. The component we are thinking of using heavily is Accordion Control.

Can you please provide an example on how to add multiple items dynamically to the Accordion?

All the example I found seems to be using XAML with hardcoded items.

 

Thanks.

Regards,

Andrew

1 Answer, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 19 Feb 2021, 09:39 AM

Hi Andrew,

Thank you for your interest in Telerik Accordion conrol.

The RadAccordion control supports adding multiple items dynamically. It provides Children property which is collection of AccordionItem.

The AccrodionItem class provides properties for customization some of them are: Header , HeaderTextContent, which you can use to create items for specific scenarios.For more information about AccordionItem, please check pur help article https://docs.telerik.com/devtools/xamarin/controls/accordion/accordion-accordionitem 

Example on how to add items dynamically:

1.Create an instance of AccordionItem.

2. Set its HeaderText and Content properties.

3. Add the item to the accordion Children collection by using accordion.Children.Add().

Please find the sample project attached to this reply. Let me know if I can assist with anything else.

Regards,
Alex
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Accordion
Asked by
Andrew
Top achievements
Rank 1
Answers by
Alex
Telerik team
Share this question
or