You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MAUI/DataGrid/conditional-styling.md
+54Lines changed: 54 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -390,6 +390,60 @@ public class ForeColorConverter : IValueConverter
390
390
391
391

392
392
393
+
### Customizing the BorderColor of a cell
394
+
You can customize the border color of individual cells in the SfDataGrid based on RowIndex and ColumnIndex property, and setting the `BorderColor` property in DataGridCell by writing the style for the [DataGridCell](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridCell.html)
public class BorderColorConverter : IValueConverter
421
+
{
422
+
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
423
+
{
424
+
var gridCell = value as DataGridCell;
425
+
426
+
if (gridCell != null)
427
+
{
428
+
if (gridCell.DataColumn!.RowIndex == 4 && gridCell.DataColumn.ColumnIndex == 3)
429
+
return Colors.Blue;
430
+
431
+
return Colors.Transparent;
432
+
}
433
+
434
+
return Colors.Transparent;
435
+
}
436
+
437
+
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
438
+
{
439
+
throw new NotImplementedException();
440
+
}
441
+
}
442
+
{% endhighlight %}
443
+
{% endtabs %}
444
+
445
+

446
+
393
447
## Style a cell based on cell value
394
448
Styling can be applied to a particular cell based on CellValue property by writing the style for the [DataGridCell](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridCell.html) TargetType.
0 commit comments