Hello,
I'd like to know how to set a custom property of a custom user control by calling a method that would serve as "data provider" for that property.
What I mean is I'd like to write something like this:
<CatsUserControl Cats={FindAllCats} />
,
where CatsUserControl is a User Control I created (which has a Property named Cats), and FindAllCats() is a method written in C# that returns a list of Cat objects.
Is this possible?
I appreciate any ideas. Thanks!
EDIT:
The whole thing began because I wanted to be able to assign a list to a property in XAML, the same way you do <Button Content="Value"/>
(except, in my case, Value is a more complex type than a string, it's a List<KeyValuePair<String, Boolean>>
).
Because I didn't find any way to do that, I thought it might be possible to call a method that returns this list and assign the returned value to the property instead.
Hope that makes things clearer.