Is it possible to make some properties of you content block only visible or enabled in Edit mode based on the value of another property? For example, if my content type has properties
HeaderBackground (custom SelectionFactoryType)
HeaderIcon (ContentReference Image selector)
Could I make the HeaderText, HeaderBackground, and HeaderIcon properties all be hidden from the Edit screen unless the "UseHeader" checkbox is selected, then those three properties appear for configuration?
You should be able to do something like this. In this sample, MainContentArea is hidden based on the DisableProperty checkbox
[EditorDescriptorRegistration(TargetType = typeof(ContentArea))]
public class DynamicallyHideProperty : EditorDescriptor
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
// Hide MainContentArea based on the setting on DisablePropertyValue setting.
if (metadata.PropertyName == "MainContentArea")
metadata.ShowForEdit = false;
It is possible but involves some dojo tweaking: https://gregwiechec.com/2015/05/extending-all-properties-view/
Aniket, metadata.FindOwnerContent() seems to always return null -- is there something I need to initialize first for this to work?
What if you do metdata.OwnerContent.Property["YourPropertyName"]
nope, OwnerContent is also null, as is Parent and Container, I am not seeing any way to retrieve a reference to anything "above" the current property.
I think Dejan's link has provided the solution. it is better to use client technique.
Yes, I ended up created a custom EditorDescriptor that allowed me to decrate a boolean model property with the name of the field it should be showing/hiding. This EditorDescriptor then specified the name of a custom dojo widget class. This dogo widget then derived from the epi checkbox widget so that when it's value changed, it would find the widget for the associated Property and do a jquery .show or .hide on that item.