From 95c8fc31994f46389059b8869c713e085a317413 Mon Sep 17 00:00:00 2001 From: Gowtham-SF4769 Date: Wed, 22 Oct 2025 18:39:00 +0530 Subject: [PATCH] MAUI-978225-[others][maui]: updated README file. --- README.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e4d32e..90072e1 100644 --- a/README.md +++ b/README.md @@ -1 +1,91 @@ -**[View document in Syncfusion Xamarin knowledge base](https://www.syncfusion.com/kb/12189/how-to-use-templateselector-in-xamarin-forms-accordion-sfaccordion)** +# template-selector-accordion-xamarin + +This sample demonstrates how to use a DataTemplateSelector with Syncfusion's SfAccordion control in a Xamarin.Forms project. The sample shows how to provide different visual templates for accordion items by using a custom `AccordionTemplateSelector` and binding the accordion to an items collection via `BindableLayout.ItemsSource`. + +For detailed guidance on the SfAccordion control and getting started with Syncfusion Accordion for Xamarin, see the official user guide: + +- [Getting Started with Xamarin Accordion (SfAccordion)](https://help.syncfusion.com/xamarin/accordion/getting-started) + +KB Link: [How to use TemplateSelector in Xamarin.Forms Accordion (SfAccordion)](https://www.syncfusion.com/kb/12189/how-to-use-templateselector-in-xamarin-forms-accordion-sfaccordion) + +## Overview + +This repository contains a small Xamarin.Forms solution named `AccordionXamarin` which demonstrates two important techniques: + +- Using a custom DataTemplateSelector (`AccordionTemplateSelector`) to return different `DataTemplate`s for items in an `SfAccordion`. +- Binding the accordion to a view model collection (`ItemInfoRepository`) using `BindableLayout.ItemsSource` and assigning the template selector with `BindableLayout.ItemTemplateSelector`. + +The pattern is useful whenever you want conditional visuals for list-like controls — for example, showing a highlighted header for certain items while keeping a default appearance for others. + +## XAML + +The following XAML demonstrates how the `AccordionTemplateSelector` is declared in `ContentPage.Resources`, how custom and default templates are defined, and how the `SfAccordion` applies the selector. + +``` + + + + + + + + + + + + + + + + +