private void RegisterChangeEvent <T>(BaseField <T> element) { element.RegisterCallback <ChangeEvent <T> >(delegate(ChangeEvent <T> evt) { if (evt.currentTarget is BindableElement e) { DynamicObjectUtility.SetObjectValue(_target, evt.newValue, e.bindingPath); } });
private bool DrawInstance(FieldInfo fieldInfo, string parentPath, int indent) { if (fieldInfo.FieldType.IsClass || fieldInfo.FieldType.IsValueType) { if (!string.IsNullOrEmpty(parentPath)) { parentPath = $"{parentPath}/"; } var path = $"{parentPath}{fieldInfo.Name}"; var obj = DynamicObjectUtility.GetObjectValue(_target, path); if (obj == null) { var newObj = Activator.CreateInstance(fieldInfo.FieldType); DynamicObjectUtility.SetObjectValue(_target, newObj, path); obj = newObj; } var titleItem = ContainerItem.Creat(fieldInfo.Name, obj, parentPath, indent, false); _container.Add(titleItem); return(true); } return(false); }