public VisualElement CreateElement(int index)
            {
                if (Property.arraySize <= index)
                {
                    Property.ResizeArray(index + 1);
                }

                var outputProperty    = Property.GetArrayElementAtIndex(index);
                var nameProperty      = outputProperty.FindPropertyRelative(nameof(GraphOutput.Name));
                var typeProperty      = outputProperty.FindPropertyRelative(nameof(GraphOutput.Type));
                var referenceProperty = outputProperty.FindPropertyRelative(nameof(GraphOutput.Expression));

                var definition = Graph.Outputs[index];

                nameProperty.stringValue = definition.Name;
                var label = new Label {
                    bindingPath = nameProperty.propertyPath
                };

                label.AddToClassList(NameUssClassName);

                var referenceField = new PropertyField(referenceProperty);

                referenceField.SetFieldLabel(null);

                var typeValue = (GraphOutputType)typeProperty.intValue;
                var typeField = new EnumButtonsField {
                    Type = typeof(GraphOutputType), value = typeValue
                }.ConfigureProperty(typeProperty);

                typeField.SetFieldLabel(null);
                typeField.RegisterCallback <ChangeEvent <Enum> >(evt =>
                {
                    referenceField.SetDisplayed((GraphOutputType)evt.newValue == GraphOutputType.Expression);
                });

                referenceField.SetDisplayed(typeValue == GraphOutputType.Expression);

                var container = new VisualElement();

                container.Add(label);
                container.Add(typeField);
                container.Add(referenceField);

                return(container);
            }
        public override void Create(VisualElement root)
        {
            var enumButtons = new EnumButtonsField("Enum Buttons");

            enumButtons.Type     = _types[0];
            enumButtons.UseFlags = false;
            enumButtons.RegisterValueChangedCallback(ValueChanged);
            root.Add(enumButtons);

            var typePopup = new UnityEditor.UIElements.PopupField <Type>("Type", _types, 0, type => type.Name, type => type.Name);

            typePopup.RegisterValueChangedCallback(e => enumButtons.Type = e.newValue);
            root.Add(typePopup);

            var flagsToggle = new Toggle("Use Flags");

            flagsToggle.RegisterValueChangedCallback(e => enumButtons.UseFlags = e.newValue);
            root.Add(flagsToggle);
        }
            public VisualElement CreateElement(int index)
            {
                if (Property.arraySize <= index)
                {
                    Property.ResizeArray(index + 1);
                }

                var inputProperty      = Property.GetArrayElementAtIndex(index);
                var nameProperty       = inputProperty.FindPropertyRelative(nameof(GraphInput.Name));
                var typeProperty       = inputProperty.FindPropertyRelative(nameof(GraphInput.Type));
                var expressionProperty = inputProperty.FindPropertyRelative(nameof(GraphInput.Expression));
                var valueProperty      = inputProperty.FindPropertyRelative(nameof(GraphInput.Value));

                var definition = Graph.Inputs[index];

                nameProperty.stringValue = definition.Name;
                var label = new Label {
                    bindingPath = nameProperty.propertyPath
                };

                label.AddToClassList(NameUssClassName);

                var expressionField = new PropertyField(expressionProperty);

                expressionField.SetFieldLabel(null);

                var valueField = new SerializedVariableField(valueProperty, definition);

                valueField.AddToClassList(ValueUssClassName);

                if (!definition.IsValid(valueField.Control.Value))
                {
                    var value = definition.Generate();
                    valueField.Inject(value);
                }

                var typeValue = (GraphInputType)typeProperty.intValue;
                var typeField = new EnumButtonsField {
                    Type = typeof(GraphInputType), value = typeValue
                }.ConfigureProperty(typeProperty);

                typeField.SetFieldLabel(null);
                typeField.RegisterCallback <ChangeEvent <Enum> >(evt =>
                {
                    var type = (GraphInputType)evt.newValue;

                    expressionField.SetDisplayed(type == GraphInputType.Expression);
                    valueField.SetDisplayed(type == GraphInputType.Value);
                });


                expressionField.SetDisplayed(typeValue == GraphInputType.Expression);
                valueField.SetDisplayed(typeValue == GraphInputType.Value);

                var container = new VisualElement();

                container.Add(label);
                container.Add(typeField);
                container.Add(expressionField);
                container.Add(valueField);

                return(container);
            }