Your understanding of ながら and のに seems correct. ながら can be used as a more formal conjunction to form a contradictory connection like "although" and "despite —ing". Your translation is, however, not correct. It should be:
Despite knowing that the classroom had been changed, my friend did not tell me.
In fact, the problem is not about the nuances of ながら and のに but the aspect of 知る. 知る is not really English "know" but the point at which you change from not knowing to knowing: "get to know", "come to know", or "learn". The state of already having the piece of information is conveyed by 知っている.
○ 授業の教室が変わったと知りながら、教えてくれませんでした
× 授業の教室が変わったと知るのに、教えてくれませんでした
○ 授業の教室が変わったと知っているのに、教えてくれませんでした
Whether a verb expresses a punctual or continuing action is not apparent from its form in Japanese (or in English), but there is a strict semantic difference. ながら ("while") neutralizes this contrast, because due to its meaning, everything that comes before is naturally an ongoing action. Thus:
- 着る "put on"
着ながら採寸ができる服 clothes that let you take your size while wearing
- 点ける "turn on"
電気を点けながら作業する do work with the lights on
- 向く "turn one's face to"
そっぽを向きながら返事をする reply looking the other way
You can also add an extra ~ている before ながら, in this case 知っていながら. This is oftentimes just redundant, but sometimes you may need disambiguation when a verb takes some time: 見つけながら "while you are trying to find" / "while/though you have found out" vs 見つけていながら only the latter.