Getting the context of a part in the containing type

Nov 23, 2010 at 1:41 AM

Is it possible for a content field or content type to discover its sibling parts in the containing content type? For example can I get my content part to behave differently depending on the type it attaches to, and data from other parts attached to that type?

Thanks

Coordinator
Nov 23, 2010 at 4:11 AM

Well, the field doesn't know what it's attached to but the parts do know their content item. From there you can use As<T> to get to other parts. As much as possible you'd want to avoid such dependencies but well, if you have a good scenario for that, go ahead!

Coordinator
Nov 23, 2010 at 2:56 PM

You can also discover everything on this type by using the ContentDefinitionManager service. You will then have access to parts, fields, and their respective settings.

Nov 24, 2010 at 12:55 AM

Thank you guys, I will give it a try.