Skip to content

Commit ca1ad1f

Browse files
Merge branch 'main' into fix-color-picker-button-binding-issue
2 parents 34c4ae5 + 06aec3e commit ca1ad1f

File tree

19 files changed

+3910
-155
lines changed

19 files changed

+3910
-155
lines changed

.github/fabricbot.json

Lines changed: 3600 additions & 0 deletions
Large diffs are not rendered by default.

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ListDetailsView/ListDetailsView.bind

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
<controls:ListDetailsView BackButtonBehavior="Automatic"
1212
ItemsSource="{Binding Emails}"
1313
NoSelectionContent="Select an item to view"
14-
CompactModeThresholdWidth="720">
14+
CompactModeThresholdWidth="720"
15+
ListPaneWidth="400">
1516
<controls:ListDetailsView.ItemTemplate>
1617
<DataTemplate>
1718
<StackPanel Margin="0,8">

Microsoft.Toolkit.Uwp.UI.Animations/Xaml/Activities/StopAnimationActivity.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public AnimationSet Animation
2929
public static readonly DependencyProperty AnimationProperty = DependencyProperty.Register(
3030
nameof(Animation),
3131
typeof(AnimationSet),
32-
typeof(StartAnimationActivity),
32+
typeof(StopAnimationActivity),
3333
new PropertyMetadata(null));
3434

3535
/// <summary>
@@ -47,7 +47,7 @@ public UIElement TargetObject
4747
public static readonly DependencyProperty TargetObjectProperty = DependencyProperty.Register(
4848
nameof(TargetObject),
4949
typeof(UIElement),
50-
typeof(StartAnimationActivity),
50+
typeof(StopAnimationActivity),
5151
new PropertyMetadata(null));
5252

5353
/// <inheritdoc/>

Microsoft.Toolkit.Uwp.UI.Behaviors/Animations/StartAnimationAction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public UIElement TargetObject
4747
public static readonly DependencyProperty TargetObjectProperty = DependencyProperty.Register(
4848
nameof(TargetObject),
4949
typeof(UIElement),
50-
typeof(StartAnimationActivity),
50+
typeof(StartAnimationAction),
5151
new PropertyMetadata(null));
5252

5353
/// <inheritdoc/>

Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/StickyHeaderBehavior.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ protected override bool Uninitialize()
4646
}
4747

4848
/// <summary>
49-
/// The UIElement that will be faded.
49+
/// The UIElement that will be sticky.
5050
/// </summary>
5151
public static readonly DependencyProperty HeaderElementProperty = DependencyProperty.Register(
52-
nameof(HeaderElement), typeof(UIElement), typeof(QuickReturnHeaderBehavior), new PropertyMetadata(null, PropertyChangedCallback));
52+
nameof(HeaderElement), typeof(UIElement), typeof(StickyHeaderBehavior), new PropertyMetadata(null, PropertyChangedCallback));
5353

5454
private ScrollViewer _scrollViewer;
5555
private double _previousVerticalScrollOffset;

Microsoft.Toolkit.Uwp.UI.Controls.Input/RadialGauge/RadialGauge.cs

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -193,34 +193,10 @@ private void ThemeListener_ThemeChanged(ThemeListener sender)
193193
OnColorsChanged();
194194
}
195195

196-
private void RadialGauge_KeyDown(object sender, KeyRoutedEventArgs e)
197-
{
198-
double step = SmallChange;
199-
var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control);
200-
if (ctrl.HasFlag(CoreVirtualKeyStates.Down))
201-
{
202-
step = LargeChange;
203-
}
204-
205-
step = Math.Max(StepSize, step);
206-
if ((e.Key == VirtualKey.Left) || (e.Key == VirtualKey.Down))
207-
{
208-
Value = Math.Max(Minimum, Value - step);
209-
e.Handled = true;
210-
return;
211-
}
212-
213-
if ((e.Key == VirtualKey.Right) || (e.Key == VirtualKey.Up))
214-
{
215-
Value = Math.Min(Maximum, Value + step);
216-
e.Handled = true;
217-
}
218-
}
219-
220196
private void RadialGauge_Unloaded(object sender, RoutedEventArgs e)
221197
{
222198
// Unregister event handlers.
223-
KeyDown -= RadialGauge_KeyDown;
199+
KeyboardAccelerators.Clear();
224200
ThemeListener.ThemeChanged -= ThemeListener_ThemeChanged;
225201
PointerReleased -= RadialGauge_PointerReleased;
226202
Unloaded -= RadialGauge_Unloaded;
@@ -439,10 +415,58 @@ protected override void OnApplyTemplate()
439415
_tickBrush = ReadLocalValue(TickBrushProperty) as SolidColorBrush;
440416
_foreground = ReadLocalValue(ForegroundProperty) as SolidColorBrush;
441417

442-
// Register event handlers.
418+
// Small step
419+
AddKeyboardAccelerator(VirtualKeyModifiers.None, VirtualKey.Left, (_, kaea) =>
420+
{
421+
Value = Math.Max(Minimum, Value - Math.Max(StepSize, SmallChange));
422+
kaea.Handled = true;
423+
});
424+
425+
AddKeyboardAccelerator(VirtualKeyModifiers.None, VirtualKey.Up, (_, kaea) =>
426+
{
427+
Value = Math.Min(Maximum, Value + Math.Max(StepSize, SmallChange));
428+
kaea.Handled = true;
429+
});
430+
431+
AddKeyboardAccelerator(VirtualKeyModifiers.None, VirtualKey.Right, (_, kaea) =>
432+
{
433+
Value = Math.Min(Maximum, Value + Math.Max(StepSize, SmallChange));
434+
kaea.Handled = true;
435+
});
436+
437+
AddKeyboardAccelerator(VirtualKeyModifiers.None, VirtualKey.Down, (_, kaea) =>
438+
{
439+
Value = Math.Max(Minimum, Value - Math.Max(StepSize, SmallChange));
440+
kaea.Handled = true;
441+
});
442+
443+
// Large step
444+
AddKeyboardAccelerator(VirtualKeyModifiers.Control, VirtualKey.Left, (_, kaea) =>
445+
{
446+
Value = Math.Max(Minimum, Value - Math.Max(StepSize, LargeChange));
447+
kaea.Handled = true;
448+
});
449+
450+
AddKeyboardAccelerator(VirtualKeyModifiers.Control, VirtualKey.Up, (_, kaea) =>
451+
{
452+
Value = Math.Min(Maximum, Value + Math.Max(StepSize, LargeChange));
453+
kaea.Handled = true;
454+
});
455+
456+
AddKeyboardAccelerator(VirtualKeyModifiers.Control, VirtualKey.Right, (_, kaea) =>
457+
{
458+
Value = Math.Min(Maximum, Value + Math.Max(StepSize, LargeChange));
459+
kaea.Handled = true;
460+
});
461+
462+
AddKeyboardAccelerator(VirtualKeyModifiers.Control, VirtualKey.Down, (_, kaea) =>
463+
{
464+
Value = Math.Max(Minimum, Value - Math.Max(StepSize, LargeChange));
465+
kaea.Handled = true;
466+
});
467+
443468
PointerReleased += RadialGauge_PointerReleased;
444469
ThemeListener.ThemeChanged += ThemeListener_ThemeChanged;
445-
KeyDown += RadialGauge_KeyDown;
446470

447471
// Apply color scheme.
448472
OnColorsChanged();
@@ -830,5 +854,19 @@ private double RoundToMultiple(double number, double multiple)
830854

831855
return number + modulo;
832856
}
857+
858+
private void AddKeyboardAccelerator(
859+
VirtualKeyModifiers keyModifiers,
860+
VirtualKey key,
861+
TypedEventHandler<KeyboardAccelerator, KeyboardAcceleratorInvokedEventArgs> handler)
862+
{
863+
var accelerator = new KeyboardAccelerator()
864+
{
865+
Modifiers = keyModifiers,
866+
Key = key
867+
};
868+
accelerator.Invoked += handler;
869+
KeyboardAccelerators.Add(accelerator);
870+
}
833871
}
834872
}

Microsoft.Toolkit.Uwp.UI.Controls.Layout/ListDetailsView/ListDetailsView.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,10 @@ protected override void OnItemsChanged(object e)
461461
/// </summary>
462462
private void OnListPaneWidthChanged()
463463
{
464-
_twoPaneView.Pane1Length = new GridLength(ListPaneWidth);
464+
if (_twoPaneView != null)
465+
{
466+
_twoPaneView.Pane1Length = new GridLength(ListPaneWidth);
467+
}
465468
}
466469
}
467470
}

Microsoft.Toolkit.Uwp.UI.Controls.Media/ImageCropper/ImageCropper.Events.cs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ private void ImageCropperThumb_KeyUp(object sender, KeyRoutedEventArgs e)
106106
_currentCroppedRect = croppedRect;
107107
}
108108

109-
UpdateImageLayout(true);
109+
if (TryUpdateImageLayout(true))
110+
{
111+
UpdateSelectionThumbs(true);
112+
UpdateMaskArea(true);
113+
}
110114
}
111115

112116
private void ImageCropperThumb_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
@@ -119,7 +123,11 @@ private void ImageCropperThumb_ManipulationCompleted(object sender, Manipulation
119123
_currentCroppedRect = croppedRect;
120124
}
121125

122-
UpdateImageLayout(true);
126+
if (TryUpdateImageLayout(true))
127+
{
128+
UpdateSelectionThumbs(true);
129+
UpdateMaskArea(true);
130+
}
123131
}
124132

125133
private void ImageCropperThumb_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
@@ -161,7 +169,12 @@ private void SourceImage_ManipulationDelta(object sender, ManipulationDeltaRoute
161169
var croppedRect = _inverseImageTransform.TransformBounds(selectedRect);
162170
croppedRect.Intersect(_restrictedCropRect);
163171
_currentCroppedRect = croppedRect;
164-
UpdateImageLayout();
172+
173+
if (TryUpdateImageLayout())
174+
{
175+
UpdateSelectionThumbs();
176+
UpdateMaskArea();
177+
}
165178
}
166179

167180
private void ImageCanvas_SizeChanged(object sender, SizeChangedEventArgs e)
@@ -171,8 +184,16 @@ private void ImageCanvas_SizeChanged(object sender, SizeChangedEventArgs e)
171184
return;
172185
}
173186

174-
UpdateImageLayout();
175-
UpdateMaskArea();
187+
if (TryUpdateImageLayout())
188+
{
189+
UpdateSelectionThumbs();
190+
}
191+
192+
if (TryUpdateAspectRatio())
193+
{
194+
UpdateSelectionThumbs();
195+
UpdateMaskArea();
196+
}
176197
}
177198
}
178199
}

0 commit comments

Comments
 (0)