The problem is that RelativeSource does not work in the following case. I use silverlight 5.
RelativeSource
//From MainPage.xaml
As others have mentioned, it's because the Popup is not part of the visual tree. Instead, you can use the Popup's PlacementTarget property to get back to the visual tree: