Skip to content

Commit 4e4e628

Browse files
committed
Merge branch 'main' into winui
# Conflicts: # UITests/UITests.Tests.MSTest/UITests.Tests.MSTest.csproj # UnitTests/UnitTests.HighPerformance.NetCore/UnitTests.HighPerformance.NetCore.csproj # UnitTests/UnitTests.NetCore/Mvvm/Test_IRecipientGenerator.cs # UnitTests/UnitTests.NetCore/Mvvm/Test_ObservableObjectAttribute.cs # UnitTests/UnitTests.NetCore/UnitTests.NetCore.csproj # UnitTests/UnitTests.Notifications.NetCore/UnitTests.Notifications.NetCore.csproj # UnitTests/UnitTests.UWP/App.xaml # UnitTests/UnitTests.UWP/UnitTests.UWP.csproj
2 parents f6d4952 + ee93385 commit 4e4e628

File tree

22 files changed

+86
-72
lines changed

22 files changed

+86
-72
lines changed

CommunityToolkit.WinUI.UI.Controls.DataGrid/DataGrid/DataGrid.xaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
<StaticResource x:Key="DataGridColumnHeaderDraggedBackgroundBrush" ResourceKey="SystemControlBackgroundChromeMediumLowBrush"/>
2929
<StaticResource x:Key="DataGridColumnHeaderPointerOverBrush" ResourceKey="SystemControlHighlightListLowBrush"/>
3030
<StaticResource x:Key="DataGridColumnHeaderPressedBrush" ResourceKey="SystemControlHighlightListMediumBrush"/>
31+
<StaticResource x:Key="DataGridRowGroupHeaderBackgroundBrush" ResourceKey="SystemControlBackgroundChromeMediumBrush"/>
32+
<StaticResource x:Key="DataGridRowGroupHeaderPressedBackgroundBrush" ResourceKey="SystemControlBackgroundListMediumBrush"/>
33+
<StaticResource x:Key="DataGridRowGroupHeaderForegroundBrush" ResourceKey="SystemControlForegroundBaseHighBrush"/>
34+
<StaticResource x:Key="DataGridRowHoveredBackgroundColor" ResourceKey="SystemListLowColor"/>
3135
</ResourceDictionary>
3236
<ResourceDictionary x:Key="HighContrast">
3337
<SolidColorBrush x:Key="InvalidBrush" Color="#FFFF00"/>
@@ -41,6 +45,10 @@
4145
<StaticResource x:Key="DataGridColumnHeaderDraggedBackgroundBrush" ResourceKey="SystemControlBackgroundChromeMediumLowBrush"/>
4246
<StaticResource x:Key="DataGridColumnHeaderPointerOverBrush" ResourceKey="SystemControlHighlightListLowBrush"/>
4347
<StaticResource x:Key="DataGridColumnHeaderPressedBrush" ResourceKey="SystemControlHighlightListMediumBrush"/>
48+
<StaticResource x:Key="DataGridRowGroupHeaderBackgroundBrush" ResourceKey="SystemControlBackgroundChromeMediumBrush"/>
49+
<StaticResource x:Key="DataGridRowGroupHeaderPressedBackgroundBrush" ResourceKey="SystemControlBackgroundListMediumBrush"/>
50+
<StaticResource x:Key="DataGridRowGroupHeaderForegroundBrush" ResourceKey="SystemControlForegroundBaseHighBrush"/>
51+
<StaticResource x:Key="DataGridRowHoveredBackgroundColor" ResourceKey="SystemListLowColor"/>
4452
</ResourceDictionary>
4553
<ResourceDictionary x:Key="Light">
4654
<SolidColorBrush x:Key="InvalidBrush" Color="#C50500"/>
@@ -54,6 +62,10 @@
5462
<StaticResource x:Key="DataGridColumnHeaderDraggedBackgroundBrush" ResourceKey="SystemControlBackgroundChromeMediumLowBrush"/>
5563
<StaticResource x:Key="DataGridColumnHeaderPointerOverBrush" ResourceKey="SystemControlHighlightListLowBrush"/>
5664
<StaticResource x:Key="DataGridColumnHeaderPressedBrush" ResourceKey="SystemControlHighlightListMediumBrush"/>
65+
<StaticResource x:Key="DataGridRowGroupHeaderBackgroundBrush" ResourceKey="SystemControlBackgroundChromeMediumBrush"/>
66+
<StaticResource x:Key="DataGridRowGroupHeaderPressedBackgroundBrush" ResourceKey="SystemControlBackgroundListMediumBrush"/>
67+
<StaticResource x:Key="DataGridRowGroupHeaderForegroundBrush" ResourceKey="SystemControlForegroundBaseHighBrush"/>
68+
<StaticResource x:Key="DataGridRowHoveredBackgroundColor" ResourceKey="SystemListLowColor"/>
5769
</ResourceDictionary>
5870
</ResourceDictionary.ThemeDictionaries>
5971

@@ -89,13 +101,9 @@
89101
<StaticResource x:Key="DataGridRowSelectedUnfocusedBackgroundOpacity" ResourceKey="ListAccentLowOpacity"/>
90102
<StaticResource x:Key="DataGridRowSelectedHoveredUnfocusedBackgroundColor" ResourceKey="SystemAccentColor"/>
91103
<StaticResource x:Key="DataGridRowSelectedHoveredUnfocusedBackgroundOpacity" ResourceKey="ListAccentMediumOpacity"/>
92-
<StaticResource x:Key="DataGridRowHoveredBackgroundColor" ResourceKey="SystemListLowColor"/>
93104
<StaticResource x:Key="DataGridRowHeaderForegroundBrush" ResourceKey="SystemControlForegroundBaseMediumBrush"/>
94105
<StaticResource x:Key="DataGridRowHeaderBackgroundBrush" ResourceKey="SystemControlBackgroundAltHighBrush"/>
95-
<StaticResource x:Key="DataGridRowGroupHeaderBackgroundBrush" ResourceKey="SystemControlBackgroundChromeMediumBrush"/>
96106
<StaticResource x:Key="DataGridRowGroupHeaderHoveredBackgroundBrush" ResourceKey="SystemControlBackgroundListLowBrush"/>
97-
<StaticResource x:Key="DataGridRowGroupHeaderPressedBackgroundBrush" ResourceKey="SystemControlBackgroundListMediumBrush"/>
98-
<StaticResource x:Key="DataGridRowGroupHeaderForegroundBrush" ResourceKey="SystemControlForegroundBaseHighBrush"/>
99107
<StaticResource x:Key="DataGridRowInvalidBrush" ResourceKey="InvalidBrush"/>
100108
<StaticResource x:Key="DataGridCellBackgroundBrush" ResourceKey="SystemControlTransparentBrush"/>
101109
<StaticResource x:Key="DataGridCellFocusVisualPrimaryBrush" ResourceKey="SystemControlFocusVisualPrimaryBrush"/>
@@ -967,4 +975,4 @@
967975
</Setter.Value>
968976
</Setter>
969977
</Style>
970-
</ResourceDictionary>
978+
</ResourceDictionary>

CommunityToolkit.WinUI.UI.Controls.DataGrid/DataGrid/DataGridRow.cs

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,40 +1122,11 @@ internal void EnsureForeground()
11221122
{
11231123
DiagnosticsDebug.Assert(this.Index != -1, "Expected Index other than -1.");
11241124

1125-
PropertyMetadata metadataInfo = DataGridRow.ForegroundProperty.GetMetadata(typeof(DataGridRow));
1126-
Brush defaultForeground = metadataInfo == null ? null : metadataInfo.DefaultValue as Brush;
1127-
Brush newForeground = null;
1125+
var newForeground = this.Index % 2 == 0 || this.OwningGrid.AlternatingRowForeground == null
1126+
? this.OwningGrid.RowForeground
1127+
: this.OwningGrid.AlternatingRowForeground;
11281128

1129-
if (this.Foreground.Equals(defaultForeground))
1130-
{
1131-
if (this.Index % 2 == 0 || this.OwningGrid.AlternatingRowForeground == null)
1132-
{
1133-
// Use OwningGrid.RowForeground if the index is even or if the OwningGrid.AlternatingRowForeground is null
1134-
if (this.OwningGrid.RowForeground != null)
1135-
{
1136-
newForeground = this.OwningGrid.RowForeground;
1137-
}
1138-
}
1139-
else
1140-
{
1141-
// Alternate row
1142-
if (this.OwningGrid.AlternatingRowForeground != null)
1143-
{
1144-
newForeground = this.OwningGrid.AlternatingRowForeground;
1145-
}
1146-
}
1147-
1148-
if (newForeground == null)
1149-
{
1150-
newForeground = this.Foreground;
1151-
}
1152-
}
1153-
else
1154-
{
1155-
newForeground = this.Foreground;
1156-
}
1157-
1158-
this.ComputedForeground = newForeground;
1129+
this.ComputedForeground = newForeground ?? this.Foreground;
11591130
}
11601131
else
11611132
{

UITests/UITests.Tests.MSTest/UITests.Tests.MSTest.csproj

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,23 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
27-
<PackageReference Include="Microsoft.Internal.MUXTestInfra.MSTest" Version="3.0.0-zmain.210615.2-CI" />
26+
<!-- MSTest -->
2827
<PackageReference Include="MSTest.TestAdapter" Version="2.2.4-preview-20210331-02" />
2928
<PackageReference Include="MSTest.TestFramework" Version="2.2.4-preview-20210331-02" />
30-
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
29+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
30+
<!-- Microsoft.UI.Xaml MSTest Extension -->
31+
<PackageReference Include="Microsoft.Internal.MUXTestInfra.MSTest" Version="3.0.0-zmain.210615.2-CI" />
32+
<!-- System packages -->
3133
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />
34+
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
3235
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
33-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
36+
<!-- Windows SDK packages -->
3437
<PackageReference Include="Microsoft.Windows.Apps.Test" Version="1.0.181205002" />
35-
<PackageReference Include="Grpc.Tools" Version="2.36.4" />
36-
<PackageReference Include="Grpc.Net.Client" Version="2.36.0" />
37-
<PackageReference Include="Grpc.Core" Version="2.36.4" />
38+
<!-- GRPC packages -->
3839
<PackageReference Include="Google.Protobuf" Version="3.15.7" />
40+
<PackageReference Include="Grpc.Core" Version="2.36.4" />
41+
<PackageReference Include="Grpc.Net.Client" Version="2.36.0" />
42+
<PackageReference Include="Grpc.Tools" Version="2.36.4" />
3943
</ItemGroup>
4044

4145
<Import Project="..\UITests.Tests.Shared\UITests.Tests.Shared.projitems" Label="Shared" />

UnitTests/UnitTests.HighPerformance.NetCore/UnitTests.HighPerformance.NetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ItemGroup>
1313
<PackageReference Include="MSTest.TestAdapter" Version="2.2.4-preview-20210331-02" />
1414
<PackageReference Include="MSTest.TestFramework" Version="2.2.4-preview-20210331-02" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
1616
</ItemGroup>
1717

1818
<!-- .NET Core 2.1 doesn't have the Unsafe type -->

UnitTests/UnitTests.HighPerformance.Shared/Enumerables/Test_ReadOnlyRefEnumerable{T}.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
#if !WINDOWS_UWP
66

77
using System;
8+
using System.Diagnostics.CodeAnalysis;
89
using System.Runtime.CompilerServices;
910
using CommunityToolkit.HighPerformance.Enumerables;
1011
using Microsoft.VisualStudio.TestTools.UnitTesting;
1112

1213
namespace UnitTests.HighPerformance.Enumerables
1314
{
1415
[TestClass]
16+
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
1517
public class Test_ReadOnlyRefEnumerable
1618
{
1719
[TestCategory("ReadOnlyRefEnumerable")]

UnitTests/UnitTests.HighPerformance.Shared/Enumerables/Test_RefEnumerable{T}.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
#if !WINDOWS_UWP
66

77
using System;
8+
using System.Diagnostics.CodeAnalysis;
89
using System.Runtime.CompilerServices;
910
using CommunityToolkit.HighPerformance.Enumerables;
1011
using Microsoft.VisualStudio.TestTools.UnitTesting;
1112

1213
namespace UnitTests.HighPerformance.Enumerables
1314
{
1415
[TestClass]
16+
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649", Justification = "Test class for generic type")]
1517
public class Test_RefEnumerable
1618
{
1719
[TestCategory("RefEnumerable")]

UnitTests/UnitTests.HighPerformance.UWP/UnitTests.HighPerformance.UWP.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
<PackageReference Include="MSTest.TestFramework">
149149
<Version>2.1.2</Version>
150150
</PackageReference>
151+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
151152
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
152153
<Version>5.0.0</Version>
153154
</PackageReference>

UnitTests/UnitTests.NetCore/Mvvm/Test_ICommandAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
#pragma warning disable CS0618
6-
5+
using System.Diagnostics.CodeAnalysis;
76
using System.Threading;
87
using System.Threading.Tasks;
98
using CommunityToolkit.Mvvm.Input;
109
using Microsoft.VisualStudio.TestTools.UnitTesting;
1110

1211
namespace UnitTests.Mvvm
1312
{
13+
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601", Justification = "Type only used for testing")]
1414
[TestClass]
1515
public partial class Test_ICommandAttribute
1616
{

UnitTests/UnitTests.NetCore/Mvvm/Test_INotifyPropertyChangedAttribute.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System.ComponentModel;
6+
using System.Diagnostics.CodeAnalysis;
67
using System.Reflection;
78
using CommunityToolkit.Mvvm.ComponentModel;
89
using Microsoft.VisualStudio.TestTools.UnitTesting;
910

1011
namespace UnitTests.Mvvm
1112
{
13+
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601", Justification = "Type only used for testing")]
1214
[TestClass]
1315
public partial class Test_INotifyPropertyChangedAttribute
1416
{

UnitTests/UnitTests.NetCore/Mvvm/Test_IRecipientGenerator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
#pragma warning disable CS0618
66

77
using System;
8+
using System.Diagnostics.CodeAnalysis;
89
using CommunityToolkit.Mvvm.Messaging;
910
using Microsoft.VisualStudio.TestTools.UnitTesting;
1011

1112
namespace UnitTests.Mvvm
1213
{
14+
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601", Justification = "Type only used for testing")]
1315
[TestClass]
1416
public partial class Test_IRecipientGenerator
1517
{

0 commit comments

Comments
 (0)