Browse Source

Fixes issue #1379 in xceedsoftware/wpftoolkit

Conform to the data contract for GridLength constructor and provide a valid double value when using the grid splitter to resize layout panes. In certain situations, a user can resize panes into negative space which is not valid.
pull/1393/head
Jacob Colyer 8 years ago
committed by GitHub
parent
commit
21c37161c6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridControl.cs

12
ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Controls/LayoutGridControl.cs

@ -416,7 +416,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
else else
{ {
var width = ( prevChildModel.DockWidth.IsAuto ) ? prevChildActualSize.Width : prevChildModel.DockWidth.Value; var width = ( prevChildModel.DockWidth.IsAuto ) ? prevChildActualSize.Width : prevChildModel.DockWidth.Value;
prevChildModel.DockWidth = new GridLength( width + delta, GridUnitType.Pixel ); var resizedWidth = width + delta;
prevChildModel.DockWidth = new GridLength( double.IsNaN(resizedWidth) ? width : resizedWidth, GridUnitType.Pixel );
} }
if( nextChildModel.DockWidth.IsStar ) if( nextChildModel.DockWidth.IsStar )
@ -426,7 +427,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
else else
{ {
var width = ( nextChildModel.DockWidth.IsAuto ) ? nextChildActualSize.Width : nextChildModel.DockWidth.Value; var width = ( nextChildModel.DockWidth.IsAuto ) ? nextChildActualSize.Width : nextChildModel.DockWidth.Value;
nextChildModel.DockWidth = new GridLength( width - delta, GridUnitType.Pixel ); var resizedWidth = width - delta;
nextChildModel.DockWidth = new GridLength( double.IsNaN(resizedWidth) ? width : resizedWidth, GridUnitType.Pixel );
} }
} }
else else
@ -438,7 +440,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
else else
{ {
var height = ( prevChildModel.DockHeight.IsAuto ) ? prevChildActualSize.Height : prevChildModel.DockHeight.Value; var height = ( prevChildModel.DockHeight.IsAuto ) ? prevChildActualSize.Height : prevChildModel.DockHeight.Value;
prevChildModel.DockHeight = new GridLength( height + delta, GridUnitType.Pixel ); var resizedHeight = height + delta;
prevChildModel.DockHeight = new GridLength( double.IsNaN(resizedHeight) ? height : resizedHeight, GridUnitType.Pixel );
} }
if( nextChildModel.DockHeight.IsStar ) if( nextChildModel.DockHeight.IsStar )
@ -448,7 +451,8 @@ namespace Xceed.Wpf.AvalonDock.Controls
else else
{ {
var height = ( nextChildModel.DockHeight.IsAuto ) ? nextChildActualSize.Height : nextChildModel.DockHeight.Value; var height = ( nextChildModel.DockHeight.IsAuto ) ? nextChildActualSize.Height : nextChildModel.DockHeight.Value;
nextChildModel.DockHeight = new GridLength( height - delta, GridUnitType.Pixel ); var resizedHeight = height - delta;
nextChildModel.DockHeight = new GridLength( double.IsNaN(resizedHeight) ? height : resizedHeight, GridUnitType.Pixel );
} }
} }

Loading…
Cancel
Save