diff --git a/samples/XamlTestApplicationPcl/Views/MainWindow.paml b/samples/XamlTestApplicationPcl/Views/MainWindow.paml index 945b9cb1b0..98633354b1 100644 --- a/samples/XamlTestApplicationPcl/Views/MainWindow.paml +++ b/samples/XamlTestApplicationPcl/Views/MainWindow.paml @@ -225,13 +225,13 @@ - + - + - + - + diff --git a/src/Perspex.Controls/GridSplitter.cs b/src/Perspex.Controls/GridSplitter.cs index 39e235cda3..57d77e8f8d 100644 --- a/src/Perspex.Controls/GridSplitter.cs +++ b/src/Perspex.Controls/GridSplitter.cs @@ -23,8 +23,8 @@ namespace Perspex.Controls /// /// Defines the property. /// - public static readonly PerspexProperty OrientationProperty = - PerspexProperty.Register(nameof(Orientation)); + public static readonly PerspexProperty OrientationProperty = + PerspexProperty.Register(nameof(Orientation)); protected Grid _grid; @@ -42,7 +42,7 @@ namespace Perspex.Controls /// /// if null, it's inferred from column/row definition (should be auto). /// - public Orientation? Orientation { + public Orientation Orientation { get { return GetValue(OrientationProperty); @@ -75,7 +75,7 @@ namespace Perspex.Controls protected override void OnDragDelta(VectorEventArgs e) { - var delta = Orientation.Value == Perspex.Controls.Orientation.Vertical ? e.Vector.X : e.Vector.Y; + var delta = Orientation == Orientation.Vertical ? e.Vector.X : e.Vector.Y; double max; double min; GetDeltaConstraints(out min, out max); @@ -97,30 +97,6 @@ namespace Perspex.Controls } } - /// - /// If orientation is not set, method automatically calculates orientation based column/row auto size. - /// - private void AutoSetOrientation() - { - if (Orientation.HasValue) - { - return; - } - var column = GetValue(Grid.ColumnProperty); - if (column < _grid.ColumnDefinitions.Count && _grid.ColumnDefinitions[column].Width.IsAuto) - { - Orientation = Perspex.Controls.Orientation.Vertical; - return; - } - var row = GetValue(Grid.RowProperty); - if (row < _grid.RowDefinitions.Count && _grid.RowDefinitions[row].Height.IsAuto) - { - Orientation = Perspex.Controls.Orientation.Horizontal; - return; - } - throw new InvalidOperationException("GridSpliter Should have Orientation, width or height set."); - } - private double GetActualLength(DefinitionBase definition) { var columnDefinition = definition as ColumnDefinition; @@ -162,8 +138,8 @@ namespace Perspex.Controls { base.OnAttachedToVisualTree(e); _grid = this.GetVisualParent(); - AutoSetOrientation(); - if (Orientation.Value == Perspex.Controls.Orientation.Vertical) + + if (Orientation == Orientation.Vertical) { Cursor = new Cursor(StandardCursorType.SizeWestEast); var col = GetValue(Grid.ColumnProperty);