The entire episode is about Barney complaining about Ted breaking the bro code because he held Robin's hand and "a bro shouldn't hold his bro's fiancé's hand"
So why did Barney bang Robin? She's Teds ex, so a bro's ex... gosh I really don't understand this episode.