Custom control with content property

Hi,

I'm working with an example of an accordion control in Xamarin.Forms. The control works great but it is not made for MVVM model. If I want to use it I would have to add views inside my ViewModel which is something I'm trying to avoid. Basically, I'm trying to implement bindable properties in order to do this but I think I need something else, I'm not sure what concept is the one I'm trying to implement but I want to do something similar to the ContentPage.Content property, my final result would be something like this:

<Accordion>
    <Accordion.Button Text="{Binding name}">
        <Accordion.Source DataSource="{Binding MySource}">
    </Accordion.Button>
    <Accordion.Button>
        <Accordion.Source>
    </Accordion.Button>
    <Accordion.Button>
        <Accordion.Source>
    </Accordion.Button>
</Accordion>

So I understand how to create the bindable properties but I don't know how to implement the Accordion.Button, Accordiong.Source ones, what types of properties would those be "Attached?" Can I create a structure like that? Also the Accordion.Button must be dynamic, it can have as many as the user wants.

Thanks
Regards

Sign In or Register to comment.