All Dynamix object classes have a generated inner description class. These classes have methods for getting information about both the type and object instances. Dynamix Developer Tools adds code to the descriptor class when you edit the properties of an object using the object editor interface but there is also a partial class in the code file (MyClass.dx6.cs or MyClass.dx6.vb) where you can add overrides.
public partial class MyClass
{
public partial class MyClassDescriptor<T>
{
//Add descriptor overrides here
}
}
Here is an overview of the overrides you can add to the descriptor class
Names and icons
In all places in the Dynamix interface where objects are shown (in trees, lists or when you select object) the name and icon is declared in the descriptor. You can override these methods if you want to have different names and icons depending on the object state. You can also generate a thumbnail for objects that you want to show in a thumbnail list.
public partial class MyClassDescriptor<T>
{
public override string GetObjectName( T o )
{
//TODO
}
public override Dynamix.Ui6.Icon GetObjectIcon( T o )
{
//TODO
}
public override ThumbnailInfo GetObjectThumbnail( T o, Size? size = null )
{
//TODO
}
}
UI Layout
Objects in Dynamix get auto generated UI's which are used when you edit objects in tools. The editor layout can be customized using the object editor interface but if you need to customize it even further you can override GetEditUiLayout in the descriptor. This can be useful if you want to add a validator, make sure that certain objects cannot be edited or add extra information to the editor ui.
public override UiObjectEditorLayout<T> GetEditUiLayout( T o )
{
var layout = base.GetEditUiLayout( o );
var headline = layout.GetPropertyEditor( x => x.Headline );
headline.Validators.Add( new NonEmptyValidator() );
var category = layout.GetPropertyEditor( x => x.Category );
category.CreateEditor = ( x, prop, val ) =>
{
var editor = new ObjectDropDownList
{
GetObjects = () => Object.GetAll<Category>()
.Where( c => c.IsActive );
}
return editor;
};
layout.Validators.Add( new CallServerValidator<T> {
Validate = ValidateMyObject
} );
return layout;
}