I am sorry this is the right solution
first create a style for the border:
<style x:key="borderStyle" targettype="{x:Type Border}" xmlns:x="#unknown">
<eventsetter event="Loaded" handler="OnBorderLoaded" />
</style>
then create your logic in the code behind:
private void OnBorderLoaded(object sender, RoutedEventArgs e)
{
var border = sender as Border;
if (border != null)
{
border.Child.Focus();
}
}
the create your popup style and make the border take the earlier style:
<style x:key="myPopupStyle" targettype="{x:Type Popup}" xmlns:x="#unknown">
<setter property="Child">
<setter.value>
<border background="White" style="{StaticResource borderStyle}">
<button name="DoneButton" content="Done Button">
HorizontalAlignment="Right"
Grid.Row="4"
Width="Auto"
Margin="4,4,4,4">
</button>
</border>
</setter.value>
</setter>
</style>
finally make your popup and give it the right style:
<popup style="{StaticResource myPopupStyle}" grid.row="1" />