Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Attached Properties with Collection

$
0
0

I'd like to use this syntax in my XAML:


<b:PersonGroup.Persons>


</b:PersonGroup.Persons>

    </Button>

So I created this attached property:

public static readonly BindableProperty PersonsProperty = BindableProperty.CreateAttached("Persons", typeof(List), typeof(PersonGroup), new List);

    public static List<Person> GetPersons(BindableObject bindable)
    {
        return (List<Person>)bindable.GetValue(PersonsProperty);
    }

    public static void SetPersons(BindableObject bindable, List<Person> value)
    {
        bindable.SetValue(PersonsProperty, value);
    }

But when XAML is parsed at runtime it says it can't find Persons property, if i use an object instead of a collection (e.g Person instead of List) it works.
Any suggestion?

Cheers


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>