Skip to main content
Home Forums Silverlight Programming Programming with .NET - General ContentPropertyAttribute in Silverlight?
5 replies. Latest Post by bryant on December 3, 2008.
(0)
psih128
Member
8 points
6 Posts
05-08-2007 3:50 PM |
is there an equivalent for WPF ContentPropertyAttribute in Silverlight clr?
I mean I'm creating some custom control. the control contains a custom children collection. I want the xaml reader to add xaml children to that collection. so instead of
<control>
<control.children>
<child1 />
<child2 />
<child3 />
</control>
I want to be able to write
Mark Rid...
Contributor
2357 points
273 Posts
05-08-2007 8:27 PM |
We do not support [edit] custom content properties in the current 1.1 Alpha release. We are looking at how best to expose later. -markProgram ManagerMicrosoftThis post is provided "as-is"
05-11-2007 3:30 PM |
Hm.... Im wondering then how does XamlReader know that it should add <Canvas>'s xaml tag children to Canvas.Children collection?
bryant
Star
9927 points
1,629 Posts
05-11-2007 4:48 PM |
The restriction only applies to custom controls, not to Silverlight native objects.
wjchrist...
104 points
51 Posts
12-03-2008 5:37 PM |
I've got this to work before. What I did is import the right namespaces, create a dependency property for the children collection "Collection(of Child)" and decorate the class with the ContentProperty attribute and point it to your collection property name.
Imports
<ContentProperty(
Public
12-03-2008 5:56 PM |
Yes, the ContentPropertyAttribute now exists. It didn't back when this thread was active since that was the 1.1 days.