diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml
index b16f8583450..b6365ae5477 100644
--- a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml
+++ b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml
@@ -28,6 +28,10 @@
+
+
+
+
@@ -41,6 +45,10 @@
+
+
+
+
@@ -54,6 +62,10 @@
+
+
+
+
@@ -89,13 +101,9 @@
-
-
-
-
@@ -967,4 +975,4 @@
-
\ No newline at end of file
+
diff --git a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGridRow.cs b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGridRow.cs
index 86840408c42..c721cf7efad 100644
--- a/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGridRow.cs
+++ b/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGridRow.cs
@@ -1122,40 +1122,11 @@ internal void EnsureForeground()
{
DiagnosticsDebug.Assert(this.Index != -1, "Expected Index other than -1.");
- PropertyMetadata metadataInfo = DataGridRow.ForegroundProperty.GetMetadata(typeof(DataGridRow));
- Brush defaultForeground = metadataInfo == null ? null : metadataInfo.DefaultValue as Brush;
- Brush newForeground = null;
+ var newForeground = this.Index % 2 == 0 || this.OwningGrid.AlternatingRowForeground == null
+ ? this.OwningGrid.RowForeground
+ : this.OwningGrid.AlternatingRowForeground;
- if (this.Foreground.Equals(defaultForeground))
- {
- if (this.Index % 2 == 0 || this.OwningGrid.AlternatingRowForeground == null)
- {
- // Use OwningGrid.RowForeground if the index is even or if the OwningGrid.AlternatingRowForeground is null
- if (this.OwningGrid.RowForeground != null)
- {
- newForeground = this.OwningGrid.RowForeground;
- }
- }
- else
- {
- // Alternate row
- if (this.OwningGrid.AlternatingRowForeground != null)
- {
- newForeground = this.OwningGrid.AlternatingRowForeground;
- }
- }
-
- if (newForeground == null)
- {
- newForeground = this.Foreground;
- }
- }
- else
- {
- newForeground = this.Foreground;
- }
-
- this.ComputedForeground = newForeground;
+ this.ComputedForeground = newForeground ?? this.Foreground;
}
else
{