I'm surprised it is hard to find an entry of に
in the dictionary that can fit the usage.
But finally I found this which is under the entry of だろう
:
(「だろうに」の形で)事実に反する仮想を述べる。
(In the form of だろうに
) Saying some supposition that is different from the facts
「もう少しがんばれば、何とかなっただろうに」
If (you) try a little harder, you should have (succeeded).
It seems that we can even treat だろうに
as a whole phrase.
I didn't find a source which give an origin of this usage. However, I don't think it is related to the case particle, nor that it is form from elision.
For the final use of the のに, it does come from the the conjunction use(source).
1[接助]《準体助詞「の」+接続助詞「に」から》活用語の連体形に付く。内容的に矛盾する二つの事柄を、意外・不服の気持ちを込めてつなげる意を表す。
(from 準体助詞「の」+接続助詞「に」) Used after 連体形. To link two contradict statement, with a feeling of unexpectedness or unsatisfactory.
「東京は晴れなのに大阪は雨だ」Although it is sunny in Tokyo, it is raining in Osaka.
「九月だというのに真夏の暑さだ」Although it is September, it is as hot as in summer.
2[終助]《1の文末用法から》活用語の連体形に付く。不平・不満・恨み・非難などの気持ちを表す。
(From 1 when used at the end of sentence) Used after 連体形. Showing feeling of dissatisfaction, disapproval, bitterness, accusation.
「これで幸せになれると思ったのに」(I) thought (I) could be happy after this.
I think this use of のに can be treated as the latter half of the sentence elided.
NOTE: The translation of explanations and examples are made by myself.