Skip to content

Commit 87bb2f0

Browse files
DYN-5796-DynamoView-DisplayLocation-Bug (#15904)
1 parent a9a909a commit 87bb2f0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs

+15
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,25 @@ public DynamoView(DynamoViewModel dynamoViewModel)
161161
// of the available monitors.
162162
if (CheckVirtualScreenSize())
163163
{
164+
System.Windows.Forms.Screen[] screens = System.Windows.Forms.Screen.AllScreens;
165+
int leftLimit = 0;
166+
int topLimit = 0;
167+
foreach (var screen in screens)
168+
{
169+
leftLimit += screen.Bounds.Width;
170+
topLimit += screen.Bounds.Height;
171+
}
172+
164173
Left = dynamoViewModel.Model.PreferenceSettings.WindowX;
165174
Top = dynamoViewModel.Model.PreferenceSettings.WindowY;
166175
Width = dynamoViewModel.Model.PreferenceSettings.WindowW;
167176
Height = dynamoViewModel.Model.PreferenceSettings.WindowH;
177+
178+
//When the previous location was in a secondary screen then the next time Dynamo is launched will try to use the same location, then we need to added this validations to show Dynamo in the right place
179+
if (Left > leftLimit)
180+
Left = 0;
181+
if (Top > topLimit)
182+
Top = 0;
168183
}
169184
else
170185
{

0 commit comments

Comments
 (0)