开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜