ModelEditorGroupingHelper Class
Provides helper methods and properties used to replace or customize the default grouping mechanism in the Model Editor‘s Nodes Tree.
Namespace: DevExpress.ExpressApp.ModelEditor
Assembly: DevExpress.ExpressApp.v19.2.dll
Declaration
Remarks
To customize the Model Editor nodes grouping, access the ModelEditorGroupingHelper instance using the ModelEditorGroupingHelper.Instance property. Place your code in the platform-agnostic module‘s constructor. For instance, the following code groups the child nodes of the IModelValidationRules node. The parent node type is passed to the ModelEditorGroupingHelper.RegisterNodeGroupPathDelegate method.
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Model;
using DevExpress.ExpressApp.ModelEditor;
using DevExpress.ExpressApp.Validation;
// ...
public sealed partial class MainDemoModule : ModuleBase {
public MainDemoModule() {
InitializeComponent();
ModelEditorGroupingHelper.Instance.RegisterNodeGroupPathDelegate(
typeof(IModelValidationRules), node => ValidationGroupPathCalculator("TargetType.Name", node));
}
public string[] ValidationGroupPathCalculator(string propertyName, IModelNode modelNode) {
string groupName = "";
object propertyValue = ModelEditorGroupingHelper.Instance.GetPropertyValue(propertyName, modelNode);
if (propertyValue != null) {
groupName = propertyValue.ToString();
}
return ModelEditorGroupingHelper.Instance.SplitGroupPath(groupName, modelNode);
}
// ...
}
As the result, the child nodes of the Validation | Rules node are grouped as follows:
Important
Do not access ModelEditorGroupingHelper from multiple modules in the solution to avoid design-time issues in the Model Editor.