protected PropertyElement CreateContent <TValue>(IComponentProperty property, ref TValue value)
        {
            Resources.Templates.Inspector.InspectorStyle.AddStyles(this);
            AddToClassList(UssClasses.Resources.Inspector);
            AddToClassList(UssClasses.Resources.ComponentIcons);

            InspectorUtility.CreateComponentHeader(this, property.Type, DisplayName);
            var foldout   = this.Q <Foldout>(className: UssClasses.Inspector.Component.Header);
            var toggle    = foldout.Q <Toggle>();
            var container = Container;

            toggle.AddManipulator(new ContextualMenuManipulator(evt => { OnPopulateMenu(evt.menu); }));

            var componentMenu = this.Q <VisualElement>(className: UssClasses.Inspector.Component.Menu);

            var content = new PropertyElement();

            foldout.contentContainer.Add(content);
            content.AddContext(Context);
            content.SetTarget(value);

            content.OnChanged += OnComponentChanged;

            foldout.contentContainer.AddToClassList(UssClasses.Inspector.Component.Container);

            if (container.IsReadOnly)
            {
                SetReadonly(foldout);
                foldout.RegisterCallback <ClickEvent, EntityInspectorContext>(OnClicked, Context, TrickleDown.TrickleDown);
            }

            return(content);
        }
        VisualElement Build()
        {
            if (m_Root == null)
            {
                m_Root = new VisualElement();
            }

            if (Source != null && Source && Target != null && Target)
            {
                var configRoot = new PropertyElement();
                configRoot.SetTarget(new BuildConfigurationInspectorData(Source, Target));
                configRoot.AddContext(new BuildConfigurationContext(this));
                m_Root.contentContainer.Add(configRoot);
            }

            m_Root.contentContainer.Add(new IMGUIContainer(ApplyRevertGUI));
            return(m_Root);
        }
        void Initialize(EntitySelectionProxy proxy)
        {
            m_Context.SetContext(proxy);
            m_Root.Clear();

            var header = new PropertyElement();

            header.AddContext(m_Context);
            header.SetTarget(new EntityHeader(m_Context));
            m_Root.Add(header);
            m_SearchField = header.Q <ToolbarSearchField>();
            m_SearchField.RegisterValueChangedCallback(evt =>
            {
                m_Filters.Clear();
                var value   = evt.newValue.Trim();
                var matches = value.Split(' ');
                foreach (var match in matches)
                {
                    m_Filters.Add(match);
                }

                SearchChanged();
            });

            m_Settings = m_Root.Q <ToolbarMenu>();
            // TODO: Remove once we have menu items.
            m_Settings.Hide();

            m_ComponentsRoot = new VisualElement();

            m_Root.Add(m_ComponentsRoot);
            Resources.Templates.Inspector.ComponentsRoot.AddStyles(m_ComponentsRoot);
            m_ComponentsRoot.AddToClassList("entity-inspector__components-root");
            m_ComponentsRoot.RegisterCallback <GeometryChangedEvent>(OnGeometryChanged);
            m_TagsRoot = new TagComponentContainer(m_Context);
            m_ComponentsRoot.Add(m_TagsRoot);

            m_InspectorVisitor = new EntityInspectorVisitor(m_ComponentsRoot, m_TagsRoot, m_Context);
            PropertyContainer.Visit(m_Context.EntityContainer, m_InspectorVisitor);

            m_Root.ForceUpdateBindings();
        }