Collection Control and Attached Property
I have 2 questions:
1) I want to create a collection control that i can use i开发者_运维知识库n xaml like this:
<local:MyCollection x:Key="mc">
<local:MyCollection.Groups>
<local:MyCollectionGroup x:Name="CG1"/>
<local:MyCollectionGroup x:Name="CG2"/>
</local:MyCollection.Groups>
</local:MyCollection>
<TextBox local:CollectionControl=mc/>
How can i do this?
2) Similiar to the above.
<local:MyCollectionGroup x:Name="CG1"/>
<local:MyCollectionGroup x:Name="CG2"/>
<TextBox local:CollectionControl=CG1,CG2/>
Have you looked into using a CompositeCollection? http://msdn.microsoft.com/en-us/library/system.windows.data.compositecollection.aspx
Typically you'd do something like
<local:MyCollection x:Key="mc">
<CompositeCollection>
<local:MyCollectionGroup x:Name="CG1"/>
<local:MyCollectionGroup x:Name="CG2"/>
</CompositeCollection>
</local:MyCollection>
精彩评论