How to set the default value property for an object represented in XAML
Say i have an object like
class Item
{
string Value {get;set;}
}
class MyClas开发者_开发技巧s
{
List<Item> Values {get;set;}
}
How can i make it so that when i'm using this object in XAML, i can set the value property like so.
<MyClass>
<Item>A</Item>
<Item>B</Item>
</MyClass>
Try this:
<MyClass>
<MyClass.Values>
<Item>A</Item>
<Item>B</Item>
<Item>C</Item>
</MyClass.Values>
</MyClass>
Found the answer, i needed to put a [ContentPropertyAttribute] on!
精彩评论