-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
When you dock a pane and try to resize it, it crashes most of the times due a negative width or height:
public static void ComputeSpliterLocation(Popup spliter, Point location, Size size)
{
if (location.X < 0)
{
spliter.HorizontalOffset = 0;
spliter.Width = size.Width + location.X;
}
if (location.Y < 0)
{
spliter.VerticalOffset = 0;
spliter.Height = size.Height + location.Y;
}
if (location.X + size.Width > SystemParameters.PrimaryScreenWidth)
spliter.Width = SystemParameters.PrimaryScreenWidth - location.X;
if (location.Y + size.Height > SystemParameters.PrimaryScreenHeight)
spliter.Height = SystemParameters.PrimaryScreenHeight - location.Y;
}The problem areas are spliter.Width = SystemParameters.PrimaryScreenWidth - location.X; and spliter.Height = SystemParameters.PrimaryScreenHeight - location.Y.
A simple change like below fixes the issue, but it could be better:
public static void ComputeSpliterLocation(Popup spliter, Point location, Size size)
{
if (location.X < 0)
{
spliter.HorizontalOffset = 0;
spliter.Width = size.Width + location.X;
}
if (location.Y < 0)
{
spliter.VerticalOffset = 0;
spliter.Height = size.Height + location.Y;
}
if (location.X + size.Width > SystemParameters.PrimaryScreenWidth)
{
if ((SystemParameters.PrimaryScreenWidth - location.X) > 0)
{
spliter.Width = SystemParameters.PrimaryScreenWidth - location.X;
}
}
if (location.Y + size.Height > SystemParameters.PrimaryScreenHeight)
{
if ((SystemParameters.PrimaryScreenHeight - location.Y) > 0)
{
spliter.Height = SystemParameters.PrimaryScreenHeight - location.Y;
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels