How to set the location of a WPF window?

前端 未结 4 2143
半阙折子戏
半阙折子戏 2020-12-06 04:31

I have a List View in which I have defined a custom cell as a user control.

In the custom cell I given user hyperlink, I am showing a WPF dialog when user clicks on

4条回答
  •  生来不讨喜
    2020-12-06 04:47

    You need to set the WindowStartupLocation to Manual (which is the default however) as well as setting the Top and Left property values.

    Setting CenterScreen causes a window to be positioned in the center of the screen that contains the mouse cursor.

    Setting WindowStartupLocation to CenterOwner causes a window to be positioned in the center of its owner window (see Owner), if specified. The owner window can be either another WPF window or a non-WPF window.

    Source

提交回复
热议问题