Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
23bde30
Initial Commit of ContentSizer
michael-hawker Jul 30, 2020
78574fb
Remove backing page from ContentSizer samples
michael-hawker Jun 15, 2021
8af0680
init commit
XAML-Knight Dec 30, 2021
935df69
split common code out to new base class
XAML-Knight Jan 5, 2022
612d1b1
Implement appropriate cursor shape
XAML-Knight Jan 5, 2022
696aa7c
stage automation peer class
XAML-Knight Jan 6, 2022
df03fad
add unit test for AutomationPeer
XAML-Knight Jan 6, 2022
49d64b0
changes for test
XAML-Knight Jan 6, 2022
0c2d100
InvertDragDirection
XAML-Knight Jan 12, 2022
a69493c
Remove GripperHoverWrapper
XAML-Knight Jan 13, 2022
5f9e58a
Further refactoring
XAML-Knight Jan 14, 2022
ce0a1ac
Pass unit test
XAML-Knight Jan 15, 2022
765a983
Gripper cursor refactor
XAML-Knight Jan 21, 2022
cfcfc02
Remove local enum
XAML-Knight Jan 20, 2022
d02b539
Removed XAML comment
XAML-Knight Jan 21, 2022
b5dc2e6
Addressing PR concerns
XAML-Knight Jan 26, 2022
a09d597
Updated UI changes
XAML-Knight Jan 31, 2022
ace8309
Address unit test reqs
XAML-Knight Jan 31, 2022
354a501
Refactor keyboard event into base class
XAML-Knight Feb 1, 2022
d5e5baa
Comment for event
XAML-Knight Feb 1, 2022
b85926b
Applying PR changes
XAML-Knight Feb 5, 2022
30689d2
Addressing PR comments
XAML-Knight Feb 8, 2022
30a1aea
Make HorizontalMove and VerticalMove in SplitBase abstract and separa…
michael-hawker Feb 26, 2022
7d74e08
Clean-up ContentSizer example to place ContentSizer outside of Expander.
michael-hawker Feb 26, 2022
96fcfe6
Fix Stylecop spacing for TODO comments
michael-hawker Feb 26, 2022
75889af
Split out TargetControl property to ContentSizer control from SplitBase
michael-hawker Mar 1, 2022
2f8379a
Add note for automation peer for ContentSizer to be generalized later
michael-hawker Mar 1, 2022
b7ff319
Move Sizer based controls under a central folder in the Layout project
michael-hawker Mar 1, 2022
06872ca
Refactor and move more logic for Sizers into SizerBase to share betwe…
michael-hawker Mar 2, 2022
9c4eec2
Centralize an OnLoaded virtual event for Sizer
michael-hawker Mar 2, 2022
2cd1051
Fix keyboard behavior for GridSplitter/ContentSizer for RTL languages
michael-hawker Mar 2, 2022
69e237f
Refactor out some properties and helper methods of SizerBase to their…
michael-hawker Mar 2, 2022
c034c27
Fixes #3949 - SizerBase, GridSplitter, and ContentSizer all use Cumul…
michael-hawker Mar 3, 2022
283d6a1
Add WPF properties `DragIncrement` and `KeyboardIncrement` to our Siz…
michael-hawker Mar 3, 2022
ffd0f29
Rename internal events for SizerBase from GridSplitter
michael-hawker Mar 3, 2022
de44a6a
Add support for IsEnabled in the VSM of SizerBase
michael-hawker Mar 3, 2022
048d2f9
Created OrientationToObjectConverter for SizerBar/GripperBarBase
michael-hawker Mar 4, 2022
893ea02
Change GripperCursor to Cursor on SizerBase/GripperBarBase
michael-hawker Mar 4, 2022
63de628
Clean-up Sizer based samples and move to central directory, remove un…
michael-hawker Mar 4, 2022
449e01d
Add PropertySizer with NavigationView sample
michael-hawker Mar 4, 2022
fdd4d12
Add Minimum and Maximum constraint properties to the PropertySizer co…
michael-hawker Mar 5, 2022
968f1e6
Make Pane open by default of NavigationView in PropertySizer example.
michael-hawker Mar 5, 2022
0ac40ef
Update AutomationPeer naming and types to be generalized (untested st…
michael-hawker Mar 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make HorizontalMove and VerticalMove in SplitBase abstract and separa…
…te implementation specific to ContentSizer
  • Loading branch information
michael-hawker committed Mar 7, 2022
commit 30a1aeae7be22c85d4fa93e9e94422751692192c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using Microsoft.Toolkit.Uwp.UI;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
Expand Down Expand Up @@ -54,5 +55,50 @@ protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)

base.OnManipulationDelta(e);
}

/// <inheritdoc/>
protected override bool HorizontalMove(double horizontalChange)
{
if (TargetControl == null)
{
return true;
}

horizontalChange = IsDragInverted ? -horizontalChange : horizontalChange;

if (!IsValidWidth(TargetControl, horizontalChange, ActualWidth))
{
return true;
}

TargetControl.Width += horizontalChange;

GripperCursor = CoreCursorType.SizeWestEast;

return false;
}

/// <inheritdoc/>
protected override bool VerticalMove(double verticalChange)
{
if (TargetControl == null)
{
return true;
}

verticalChange = IsDragInverted ? -verticalChange : verticalChange;

if (!IsValidHeight(TargetControl, verticalChange, ActualHeight))
{
return true;
}

// Do we need our ContentResizeDirection to be 4 way? Maybe 'Auto' would check the horizontal/vertical alignment of the target???
TargetControl.Height += verticalChange;

GripperCursor = CoreCursorType.SizeNorthSouth;

return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
base.OnManipulationDelta(e);
}

private new bool VerticalMove(double verticalChange)
/// <inheritdoc/>
protected override bool VerticalMove(double verticalChange)
{
if (CurrentRow == null || SiblingRow == null)
{
Expand Down Expand Up @@ -184,7 +185,8 @@ protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
return false;
}

private new bool HorizontalMove(double horizontalChange)
/// <inheritdoc/>
protected override bool HorizontalMove(double horizontalChange)
{
if (CurrentColumn == null || SiblingColumn == null)
{
Expand Down
59 changes: 11 additions & 48 deletions Microsoft.Toolkit.Uwp.UI.Controls.Layout/GridSplitter/SplitBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
/// Base class for splitting/resizing controls
/// </summary>
[ContentProperty(Name = nameof(Content))]
public partial class SplitBase : Control
public abstract partial class SplitBase : Control
{
/// <summary>
/// Check for new requested vertical size is valid or not
Expand Down Expand Up @@ -153,6 +153,7 @@ public ContentResizeDirection ResizeDirection
public static readonly DependencyProperty ResizeDirectionProperty =
DependencyProperty.Register(nameof(ResizeDirection), typeof(ContentResizeDirection), typeof(SplitBase), new PropertyMetadata(ContentResizeDirection.Vertical));

//// TODO: Move to ContentSizer
/// <summary>
/// Gets or sets the control that the <see cref="SplitBase"/> is resizing. Be default, this will be the visual ancestor of the <see cref="SplitBase"/>.
/// </summary>
Expand Down Expand Up @@ -186,6 +187,7 @@ private static void OnTargetControlChanged(DependencyObject d, DependencyPropert
}
}

//// TODO: Check if this is ContentSizer only property
/// <summary>
/// Gets or sets a value indicating whether the <see cref="SplitBase"/> control is resizing in the opposite direction.
/// </summary>
Expand All @@ -202,57 +204,18 @@ public bool IsDragInverted
DependencyProperty.Register(nameof(IsDragInverted), typeof(bool), typeof(SplitBase), new PropertyMetadata(false));

/// <summary>
/// Process requested vertical resizing.
/// Method to process the requested horizontal resizing.
/// </summary>
/// <param name="verticalChange">The requested vertical change</param>
/// <returns><see cref="bool"/> result of processed vertical change</returns>
protected bool VerticalMove(double verticalChange)
{
if (TargetControl == null)
{
return true;
}

verticalChange = IsDragInverted ? -verticalChange : verticalChange;

if (!IsValidHeight(TargetControl, verticalChange, ActualHeight))
{
return true;
}

// Do we need our ContentResizeDirection to be 4 way? Maybe 'Auto' would check the horizontal/vertical alignment of the target???
TargetControl.Height += verticalChange;

GripperCursor = CoreCursorType.SizeNorthSouth;

return false;
}
/// <param name="horizontalChange">The requested horizontal change</param>
/// <returns><see cref="bool"/> indicates if the change was made</returns>
protected abstract bool HorizontalMove(double horizontalChange);

/// <summary>
/// Process requested horizontal resizing.
/// Method to process the requested vertical resizing.
/// </summary>
/// <param name="horizontalChange">The requested horizontal change</param>
/// <returns><see cref="bool"/> result of processed horizontal change</returns>
protected bool HorizontalMove(double horizontalChange)
{
if (TargetControl == null)
{
return true;
}

horizontalChange = IsDragInverted ? -horizontalChange : horizontalChange;

if (!IsValidWidth(TargetControl, horizontalChange, ActualWidth))
{
return true;
}

TargetControl.Width += horizontalChange;

GripperCursor = CoreCursorType.SizeWestEast;

return false;
}
/// <param name="verticalChange">The requested vertical change</param>
/// <returns><see cref="bool"/> indicates if the change was made</returns>
protected abstract bool VerticalMove(double verticalChange);

/// <summary>
/// Processes KeyUp event
Expand Down