The correct answer is
Cuando tengo puesta ropa elegante...
(the rest is up to you; if you go as you did, note it should be trato de no ensuciarla).
In dictionaries or lists of expressions you will find this as
tener puesto, but puesto works like an adjective (it's not the invariable passive participle as in the compound tenses, e.g. haber puesto).¹ This one has to agree with the direct object, in this case ropa, in gender and number. So you would also say
Cuando tengo puesto un sombrero... (masc. sing.)
Cuando tengo puestos mis zapatos nuevos... (masc. pl.)
Cuando tengo puestas las medias a rayas... (fem. pl.)
This is not the only expression using tener + adjective. It's actually a special usage of tener that is similar in meaning (though not identical in grammar) to the perfective tenses with haber.² For example, tener listo and tener preparado mean "to have something ready/prepared, to have readied/prepared something":
Ya tengo lista mi mochila.
Ya tengo preparadas las valijas.
So cuando tengo puesta ropa means more or less the same as una vez que / después de que me he puesto ropa (that is, "once I have put such-and-such clothes on..."), but we mostly think of it as a state, "when I'm wearing such-and-such clothes...".³
Notes:
The Spanish passive participle has two main usages: in the compound tenses, with the auxiliary haber, where it is invariable; and in the periphrastic passive voice, with the auxiliary ser, as well as in related constructions with estar and ponerse, where it acts like an adjective and has to agree with the referent in gender and number. It's a matter of theory whether e.g. puesto in tener puesto is an adjective or a variable participle; it doesn't really change anything for the speaker.
Constructions with haber and tener are semantically and historically related. The Latin verb habere actually meant "to have" (no etymological relation with English there!), and only later started being replaced by the descendants of the verb tenere ("to hold"). So the near-equivalence of me he puesto ropa "I have put clothes on" and tengo puesta ropa "I'm wearing clothes" has a historical reason.
Note that, as with sitting and standing, English prefers a continuous tense ("I'm wearing...") where Spanish uses a perfective or static tense ("Tengo puesto...").