I am trying to center a WPF Window on the current position of the mouse cursor. Getting the mouse coordinates is no problem, but I need to determine the width and height of the window in order to calculate the offset for setting the 'Left' and 'Top' properties.
Is there a way to determine the width and height of a window before showing it (calling the 'Show' method)?
I have 'SizeToContent' set to true on my window so that the content determines the actual window size. I have already tried calling 'Measure' and was expecting this to set 'DesiredSize' but it didn't.