internal static void SetCallbacks <TValue>(
            ref TValue value,
            PropertyPath path,
            PropertyElement root,
            PropertyElement field)
        {
            field.SetRoot(root);
            field.SetTarget(value);
            field.binding = new PropertyBinding <TValue>(field, root, path);

            var r = root;
            var p = path;

            field.OnChanged += (element, propertyPath) =>
            {
                r.SetValue(p, element.GetTarget <TValue>());
                element.SetTarget(r.GetValue <TValue>(p));
                var fullPath = new PropertyPath();
                fullPath.PushPath(p);
                fullPath.PushPath(propertyPath);
                r.NotifyChanged(fullPath);
            };
        }