Apply without undo/Dont Save Components

I have a script that creates a temporary component when loading data. The Component gets marked on creation with HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor.

I have an extra editor window in which I load/configure/save this temporary component. Until now I used a propertyfield and ApplyModifiedPropertiesWithoutUndo on the serialized object created from the temporary component. I use withoutUndo because otherwise unity would mark my scene dirty, even though the only change is to a component marked with dontsave.

Now I want to recreate this editor window with UIToolkit, but I’m struggling with this point. I’ve tried binding the required property of the so to the propertyfield and editing works fine, but I can’t seem to find a way to stop unity from marking my scene dirty. The Bind/PropertyField seems to automatically create undos (even though the component is still marked with dontSave). I’d be fine with having undos (even though they aren’t particularly useful in this case) but I don’t want the scene marked dirty when there are actually no changes to save. How would I go about doing this with UIToolkit?

I would say you’d need to opt out of the automatic binding.
However you can leverage the TrackPropertyValue() functionality, which is a described here:

You’d be responsible for keeping the UI and data in sync.
And by doing that you will be able to call ApplyModifiedPropertiesWithoutUndo().

Sounds good, but how do I set the value of a UIToolkit PropertyField without Bind (if that is what opting out of the automatic binding means)? Because I still want to use a propertyfield, since I am drawing a list of different data entries (so I don’t know in advance what UI Elements I have to draw, but propertyField can figure it out on the fly). The PropertyField doesn’t have a value, so how would that work?