Hi Raymond,
You need to retrieve
the entire row data in the converter. You can achieve this with the code
snippet below. We have shared a simple sample for your reference.
Code snippet:
|
// Xaml page
<ContentPage.Resources>
<local:ColorConverter
x:Key="converter" />
<Style
TargetType="syncfusion:DataGridCell">
<Setter
Property="Background"
Value="{Binding
Source={RelativeSource Mode=Self}, Converter={StaticResource
Key=converter}}" />
</Style>
</ContentPage.Resources>
// Xaml.cs page
public class ColorConverter :
IValueConverter
{
object IValueConverter.Convert(object
value, Type targetType, object parameter, CultureInfo info)
{
var rowData = (value as
DataGridCell).BindingContext as Employee;
if (rowData != null &&
rowData.EmployeeID == 1005)
{
return Colors.LightBlue;
}
else
return Colors.White;
}
public object ConvertBack(object value,
Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
|
If you have any misunderstandings or if your needs differ, please provide clear
details about your use case. You can include additional information regarding
the expected behavior. This extra detail will enable us to thoroughly address
your request and provide an appropriate solution.
regards,
Sethupathy D.
Attachment:
SfDataGridSample_5d2c540.zip