1. I need a dress to wear at the party.

2. I need a dress to wear to the party.

(#1 means I need a dress which I am going to wear at the party. So I will take a dress and wear the dress at a dressing room. Then I will join the party. #2 means I need a dress which I will wear at home for the party. So I will wear the dress at home. Then I will go to the party. Is my explanation right?)

Yes. OR 1. I will put it on in a dressing room at the party. vs. 2. I will put it on and then go to the party.

Sra