We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Change the color and boldness of part of cell text


I need to change the color and boldness of part of cell text, as shown below (initial red and bold):


I use model view to build the sfDataGrid content, as shown in the code snippet below:


            <sfGrid:SfDataGrid x:Name="dataGrid" ItemsSource="{Binding RestoreSteps}"

                               SelectionMode="None" BackgroundColor="Transparent" AutoGenerateColumns="True" >
                    <sfGrid:GridTemplateColumn MappingName="Description" Width="220">
                                <Label Text = "{Binding Description}" TextColor="#003399" FontSize="12"
                                       HorizontalOptions="StartAndExpand" VerticalOptions="StartAndExpand" />
                    <sfGrid:GridImageColumn MappingName="ImageStatus" Width="32" >
                    <sfGrid:GridTextColumn MappingName="ProgressPercentual" TextAlignment="End" Width="35" CellTextSize="12" />
                    <sfGrid:GridTextColumn MappingName="InitialDate" TextAlignment="Start" Width="1" IsHidden="True" />
                    <sfGrid:GridTextColumn MappingName="EndDate" TextAlignment="Start" Width="100" CellTextSize="12" />


            Step = new RestoreStep();

            Step.Descricao = "First Step: Search checked Fields";
            Step.PercentualProgresso = null;
            Step.DataFim = null;

            Step = new RestorePasso();
            Step.Descricao = "Second Step: Change selected Fields";
            Step.PercentualProgresso = null;
            Step.DataFim = null;

How can I do this?

Thanks in advance,

Marcelo Camarate

2 Replies

SV Suja Venkatesan Syncfusion Team October 19, 2022 10:33 AM

Hi Marcelo,

We would like to let you know that SfDataGrid does not have direct support to customize the part of cell value. Currently, we are checking the possibility to achieve your requirement in sample level. We will update you with further details on or before October 20, 2022. We appreciate your patience until then.



SV Suja Venkatesan Syncfusion Team October 21, 2022 08:12 AM

Hi Marcelo,

Regarding your requirement “Change the color and boldness of part of cell text” ,

As we mentioned in our previous update SfDataGrid does not have direct support to customize the part of cell value. You achieve your requirement by setting customising the binded values of the label using FormattedString and binding it to the label FormattedText,  as like below code snippet.

Code Snippet:



        <local:Customstyle x:Key="customstyle" />

        <local:CellStyleConverter x:Key="cellStyleConverter" />


    <sfgrid:SfDataGrid x:Name="dataGrid"

                       GridStyle="{StaticResource customstyle}"


                       ItemsSource="{Binding OrdersInfo}">


            <sfgrid:GridTemplateColumn MappingName="Description" Width="220">



                        <Label FormattedText = "{Binding Description,Converter={StaticResource cellStyleConverter}}" FontSize="12"

                                       HorizontalOptions="StartAndExpand" VerticalOptions="StartAndExpand" />




            <sfgrid:GridTextColumn MappingName="OrderID" />


    public class CellStyleConverter : IValueConverter


        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)


            if (value != null)


                var val = value as string;

                string[] words = val.Split(':');

                var formattedString = new FormattedString();

                formattedString.Spans.Add(new Span { Text = words[0] +" : ", ForegroundColor = Color.Red, FontAttributes = FontAttributes.Bold });

                var span = new Span { Text = words[1],ForegroundColor=Color.Blue };


                return formattedString as FormattedString;


            return null;


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)


            return null;



Please refer more about the formatted text of label in the below link.

Reference link: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/label#formatted-text

We have attached a runnable sample based on your requirement for your reference. You can customize the sample as per your wish. Please let us know if you need any further assistance.



Attachment: DataGridXamarin_58980aca.zip

Live Chat Icon For mobile
Up arrow icon