MarkDirtyRepaint not working

in the editor inspector, I am creating a List of my own.
when I am adding a new element to the list, it wouldn’t update the inspector.
I have tried to do “MarkDirtyRepaint” , “ApplyModifiedProperties”, “Update”, and they all not doing any effect.
I want it to rebuild the hierarchy so it would add the new element.
how can I do it ?

If I understand correctly, you know when to refresh the hierarchy but you’re not too sure how to trigger some kind of automatic full-rebuild of the inspector content?

Say you have your custom Editor with an public override VisualElement CreateInspectorGUI() method. What you could do is split it into two parts, one that creates the root element and one that populates it, and have the CreateInspectorGUI method create the element, populate it and return it. Say you now have a PopulateInspector(VisualElement root) method, then whenever you wanted to call MarkDirtyRepaint();, you can instead call PopulateInspector(root); instead. Just make sure you call root.Clear(); before you add any new content on top of it.

Hope this helps!