Skip to content

Commit a650bb5

Browse files
authored
Merge branch 'master' into specify-datagrid-hover-style
2 parents a61f1c4 + 8c6f7e3 commit a650bb5

File tree

53 files changed

+1396
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1396
-207
lines changed

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ IF NOT CERTAIN ABOUT THE FEATURE AND REQUIRE MORE CLARITY THEN PLEASE POST ON "I
1515
<!-- Please describe or link to any existing issues or discussions.
1616
A clear and concise description of what the problem is, starting with the user story.
1717
Provide examples of the restrictions in the current environment that hinders the work your users or you want to perform. What are the ways this new feature will help transform and deliver those results?
18-
For example, I am currently using the InfiniteCanvas control which lacks the ribbon control feature. I am looking to improve user experience therefore i would like to use that in my project to provide ease of accessibility and a user-friendly interface. This new feature will provide quick access to the toolbar, enhance space utilization, etc [...] -->
18+
For example, I am currently using the InfiniteCanvas control which lacks the TabbedCommandBar control feature. I am looking to improve user experience therefore i would like to use that in my project to provide ease of accessibility and a user-friendly interface. This new feature will provide quick access to the toolbar, enhance space utilization, etc [...] -->
1919

2020

2121
## Describe the solution

Microsoft.Toolkit.Diagnostics/Microsoft.Toolkit.Diagnostics.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- Guard: Helper methods to verify conditions when running code.
1212
- ThrowHelper: Helper methods to efficiently throw exceptions.
1313
</Description>
14-
<PackageTags>UWP Toolkit Windows IncrementalLoadingCollection String Array extensions helpers</PackageTags>
14+
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;extensions;helpers</PackageTags>
1515
</PropertyGroup>
1616
<Choose>
1717
<When Condition=" '$(TargetFramework)' == 'netstandard1.4' ">

Microsoft.Toolkit.HighPerformance/Memory/Internals/ThrowHelper.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ public static void ThrowArgumentExceptionForDestinationTooShort()
2727
throw new ArgumentException("The target span is too short to copy all the current items to");
2828
}
2929

30+
/// <summary>
31+
/// Throws an <see cref="ArgumentException"/> when the target span does not have the same shape as the source.
32+
/// </summary>
33+
public static void ThrowArgumentExceptionForDestinationWithNotSameShape()
34+
{
35+
throw new ArgumentException("The target span does not have the same shape as the source one");
36+
}
37+
3038
/// <summary>
3139
/// Throws an <see cref="ArrayTypeMismatchException"/> when using an array of an invalid type.
3240
/// </summary>

Microsoft.Toolkit.HighPerformance/Memory/ReadOnlySpan2D{T}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,14 +654,14 @@ public void CopyTo(Span<T> destination)
654654
/// </summary>
655655
/// <param name="destination">The destination <see cref="Span2D{T}"/> instance.</param>
656656
/// <exception cref="ArgumentException">
657-
/// Thrown when <paramref name="destination" /> is shorter than the source <see cref="ReadOnlySpan2D{T}"/> instance.
657+
/// Thrown when <paramref name="destination" /> does not have the same shape as the source <see cref="ReadOnlySpan2D{T}"/> instance.
658658
/// </exception>
659659
public void CopyTo(Span2D<T> destination)
660660
{
661661
if (destination.Height != Height ||
662662
destination.Width != Width)
663663
{
664-
ThrowHelper.ThrowArgumentException();
664+
ThrowHelper.ThrowArgumentExceptionForDestinationWithNotSameShape();
665665
}
666666

667667
if (IsEmpty)

Microsoft.Toolkit.HighPerformance/Memory/Span2D{T}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,14 +767,14 @@ public void CopyTo(Span<T> destination)
767767
/// </summary>
768768
/// <param name="destination">The destination <see cref="Span2D{T}"/> instance.</param>
769769
/// <exception cref="ArgumentException">
770-
/// Thrown when <paramref name="destination" /> is shorter than the source <see cref="Span2D{T}"/> instance.
770+
/// Thrown when <paramref name="destination" /> does not have the same shape as the source <see cref="Span2D{T}"/> instance.
771771
/// </exception>
772772
public void CopyTo(Span2D<T> destination)
773773
{
774774
if (destination.Height != Height ||
775775
destination.width != this.width)
776776
{
777-
ThrowHelper.ThrowArgumentException();
777+
ThrowHelper.ThrowArgumentExceptionForDestinationWithNotSameShape();
778778
}
779779

780780
if (IsEmpty)

Microsoft.Toolkit.HighPerformance/Microsoft.Toolkit.HighPerformance.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
- Ref&lt;T&gt;: a stack-only struct that can store a reference to a value of a specified type.
2323
- NullableRef&lt;T&gt;: a stack-only struct similar to Ref&lt;T&gt;, which also supports nullable references.
2424
</Description>
25-
<PackageTags>UWP Toolkit Windows core standard unsafe span memory string array stream buffer extensions helpers parallel performance</PackageTags>
25+
<PackageTags>Windows;Community;Toolkit;WCT;UWP;core;standard;unsafe;span;memory;string;array;stream;buffer;extensions;helpers;parallel;performance</PackageTags>
2626
</PropertyGroup>
2727
<Choose>
2828
<When Condition=" '$(TargetFramework)' == 'netstandard1.4' ">

Microsoft.Toolkit.Mvvm/Microsoft.Toolkit.Mvvm.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- StrongReferenceMessenger: a high-performance messaging system that trades weak references for speed.
1818
- Ioc: a helper class to configure dependency injection service containers.
1919
</Description>
20-
<PackageTags>UWP Toolkit Windows MVVM MVVMToolkit observable Ioc dependency injection services extensions helpers</PackageTags>
20+
<PackageTags>Windows;Community;Toolkit;WCT;UWP;WinUI;WPF;Xamarin;Forms;Uno;Platform;MVVM;Toolkit;MVVMToolkit;INotifyPropertyChanged;observable;Ioc;dependency injection;services;extensions;helpers</PackageTags>
2121
</PropertyGroup>
2222

2323
<!-- .NET Standard 2.0 doesn't have the Span<T> and IAsyncEnumerable<T> types -->

Microsoft.Toolkit.Uwp.Connectivity/Microsoft.Toolkit.Uwp.Connectivity.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>uap10.0.17763</TargetFrameworks>
55
<Title>Windows Community Toolkit Devices</Title>
66
<Description>This library enables easier consumption of connectivity Devices/Peripherals and handle its connection to Windows devices. It contains BluetoothLE and Network connectivity helpers.</Description>
7-
<PackageTags>UWP Toolkit Windows Devices Bluetooth BluetoothLE BLE Networking</PackageTags>
7+
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Devices;Bluetooth;LE;BluetoothLE;BLE;Networking</PackageTags>
88
</PropertyGroup>
99

1010
<ItemGroup>

Microsoft.Toolkit.Uwp.DeveloperTools/FocusTracker/FocusTracker.cs

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ public partial class FocusTracker : Control
3434

3535
private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
3636
{
37-
var focusTracker = d as FocusTracker;
38-
39-
if (e.NewValue != null && (bool)e.NewValue)
37+
if (d is FocusTracker focusTracker)
4038
{
41-
focusTracker?.Start();
42-
}
43-
else
44-
{
45-
focusTracker?.Stop();
39+
if (e.NewValue != null && (bool)e.NewValue)
40+
{
41+
focusTracker.Start();
42+
}
43+
else
44+
{
45+
focusTracker.Stop();
46+
}
4647
}
4748
}
4849

49-
private DispatcherQueueTimer updateTimer;
5050
private TextBlock controlName;
5151
private TextBlock controlType;
5252
private TextBlock controlAutomationName;
@@ -69,32 +69,42 @@ public FocusTracker()
6969
DefaultStyleKey = typeof(FocusTracker);
7070
}
7171

72+
/// <summary>
73+
/// Update the visual state of the control when its template is changed.
74+
/// </summary>
75+
protected override void OnApplyTemplate()
76+
{
77+
controlName = GetTemplateChild("ControlName") as TextBlock;
78+
controlType = GetTemplateChild("ControlType") as TextBlock;
79+
controlAutomationName = GetTemplateChild("ControlAutomationName") as TextBlock;
80+
controlFirstParentWithName = GetTemplateChild("ControlFirstParentWithName") as TextBlock;
81+
}
82+
7283
private void Start()
7384
{
74-
if (updateTimer == null)
85+
// Get currently focused control once when we start
86+
if (Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "XamlRoot") && XamlRoot != null)
7587
{
76-
updateTimer = DispatcherQueue.GetForCurrentThread().CreateTimer();
77-
updateTimer.Tick += UpdateTimer_Tick;
88+
FocusOnControl(FocusManager.GetFocusedElement(XamlRoot) as FrameworkElement);
89+
}
90+
else
91+
{
92+
FocusOnControl(FocusManager.GetFocusedElement() as FrameworkElement);
7893
}
7994

80-
updateTimer.Start();
95+
// Then use FocusManager event from 1809 to listen to updates
96+
FocusManager.GotFocus += FocusManager_GotFocus;
8197
}
8298

8399
private void Stop()
84100
{
85-
updateTimer?.Stop();
101+
FocusManager.GotFocus -= FocusManager_GotFocus;
86102
ClearContent();
87103
}
88104

89-
/// <summary>
90-
/// Update the visual state of the control when its template is changed.
91-
/// </summary>
92-
protected override void OnApplyTemplate()
105+
private void FocusManager_GotFocus(object sender, FocusManagerGotFocusEventArgs e)
93106
{
94-
controlName = GetTemplateChild("ControlName") as TextBlock;
95-
controlType = GetTemplateChild("ControlType") as TextBlock;
96-
controlAutomationName = GetTemplateChild("ControlAutomationName") as TextBlock;
97-
controlFirstParentWithName = GetTemplateChild("ControlFirstParentWithName") as TextBlock;
107+
FocusOnControl(e.NewFocusedElement as FrameworkElement);
98108
}
99109

100110
private void ClearContent()
@@ -105,19 +115,8 @@ private void ClearContent()
105115
controlFirstParentWithName.Text = string.Empty;
106116
}
107117

108-
private void UpdateTimer_Tick(object sender, object e)
118+
private void FocusOnControl(FrameworkElement focusedControl)
109119
{
110-
FrameworkElement focusedControl;
111-
112-
if (Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "XamlRoot") && XamlRoot != null)
113-
{
114-
focusedControl = FocusManager.GetFocusedElement(XamlRoot) as FrameworkElement;
115-
}
116-
else
117-
{
118-
focusedControl = FocusManager.GetFocusedElement() as FrameworkElement;
119-
}
120-
121120
if (focusedControl == null)
122121
{
123122
ClearContent();

Microsoft.Toolkit.Uwp.DeveloperTools/Microsoft.Toolkit.Uwp.DeveloperTools.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
-FocusTrackerControl : The FocusTracker Control is a feature that can be used to display information about the current focused XAML element.
1010
-Themes : Provides the source path of the resource dictionaries for the FocusTracker.
1111
</Description>
12-
<PackageTags>UWP Toolkit Windows Controls XAML Developer Tools Accessibility AlignmentGrid</PackageTags>
12+
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Controls;XAML;Developer;Tools;Accessibility;Alignment;Grid;AlignmentGrid</PackageTags>
1313
<!-- ARM64 builds for managed apps use .NET Native. We can't use the Reflection Provider for that. -->
1414
<EnableTypeInfoReflection Condition="'$(Configuration)' == 'Debug'">false</EnableTypeInfoReflection>
1515
</PropertyGroup>

0 commit comments

Comments
 (0)