In my case I want my "Find" tool box to appear top-right corner of the RichTextBox control.
It is done with this code:
// Assumes variable: RichTextBox m_Box, Window m_FindWordDialog
m_FindWordDialog.Show( ); // Let dialog show itself first
// Note: I had to use ActualWidth because m_Box.Width somehow is (NaN) in my case
// Not tested in different DPI.
Point locationFromScreen = m_Box.PointToScreen( new Point(m_Box.ActualWidth, 0) );
m_FindWordDialog.Left = locationFromScreen.X - m_FindWordDialog.Width;
m_FindWordDialog.Top = locationFromScreen.Y;
My search window XAML has following properties.
WindowStartupLocation="Manual" Left="0" Top="0"
It will briefly appear on its initial location and jump a bit, but I can live with it. Actually any value is fine, WindowStartupLocation="CenterOwner"
also work, it just jump from center of parent. Or as dirty workaround, you could use manual mode and let it start in faraway position to not let user see jumping.
To make it appear relative on desktop position, acquire the screen workspace location, you can check: How to set the location of WPF window to the bottom right corner of desktop?