File tree Expand file tree Collapse file tree 1 file changed +4
-33
lines changed
Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid Expand file tree Collapse file tree 1 file changed +4
-33
lines changed Original file line number Diff line number Diff line change @@ -1122,40 +1122,11 @@ internal void EnsureForeground()
1122
1122
{
1123
1123
DiagnosticsDebug . Assert ( this . Index != - 1 , "Expected Index other than -1." ) ;
1124
1124
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 ;
1128
1128
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 ;
1159
1130
}
1160
1131
else
1161
1132
{
You can’t perform that action at this time.
0 commit comments