I am having extreme difficulties getting a ProWindow to display where I want it to. It doesn't matter how I define the window (either in XAML or programmatically), the window always displays in the same location that it was last located when it last closed. I can set the WindowStartupLocation to "CenterOwner" with the Owner set to the Application.Current.MainWindow, which should open the window in the center of the Pro application. However, that doesn't work. I can also set the owner to be the center of another window and that doesn't work. Additionally, just for testing purposes, I can set the WindowStartupLocation to "Manual" and define a top and left for the window, but that doesn't work. It doesn't matter what I do, the result is always the same. The window just opens in the last location that it was closed. This is clearly a problem. As an fyi, I am developing with the C# SDK for ArcGIS Pro in 3.1.1. Does anyone have any idea what could be causing this problem?
Solved! Go to Solution.
Hi Dave, can u try:
_proWindow.SaveWindowPosition = false;//override last position of the window
we will make sure this gets added to the Pro SDK documentation.
Hi Dave, can u try:
_proWindow.SaveWindowPosition = false;//override last position of the window
we will make sure this gets added to the Pro SDK documentation.
Charlie,
Thank you! That works perfectly and was just what I needed.
Just for others looking for the complete snippet that will allow to manually position the popup window (works for both Show() and ShowDialog()):
protected override void OnClick()
{
//already open?
if (_prowindow != null)
return;
// set a fixed offset for the Window on the top/left
double left = 250; //Window's left edge, in relation to the desktop
double top = 150; //Window's top edge, in relation to the desktop
_prowindow = new ProWindow();
_prowindow.WindowStartupLocation = System.Windows.WindowStartupLocation.Manual;
_prowindow.Left = left;
_prowindow.Top = top;
_prowindow.SaveWindowPosition = false;
_prowindow.Owner = FrameworkApplication.Current.MainWindow;
_prowindow.Closed += (o, e) => { _prowindow = null; };
//_prowindow.Show();
//uncomment for modal
_prowindow.ShowDialog();
}