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
close icon

CellStyleSelector on Realtime application

We have a real-time application that the style of a cell will depend on the value on the other cell on the same row.

Thus, we try to use the CellStyleSelector to help update the cell style on real time.

The styles are applied correctly during the Grid Initialization, however, when the data are updating, we expect the cell style will be changed accordingly, but it doesn't.

The attachment is a project to reproduce the issue.
In the project, we expect that when Change >=0, we will apply Bold to the Symbol cell.

Attachment: PerformanceDemo_4d0f3818.rar

1 Reply

FP Farjana Parveen Ayubb Syncfusion Team August 12, 2014 11:09 AM UTC

Hi Antony,

 

Thank you for contacting Syncfusion Support.

 

We analyzed your query. You can achieve your requirement by using the Converter for changing the Symbol column weight to Bold while Changing>=0.

 

Please refer the following code snippet and sample in the following location:

 

Code Snippet(XAML) :

<syncfusion:GridTemplateColumn MappingName="Symbol" TextAlignment="Left"                                                                           CellStyleSelector="{StaticResource stockCellStyleSelector}" UpdateTrigger="PropertyChanged">

                                <syncfusion:GridTemplateColumn.CellTemplate>

                                   <DataTemplate>

                                        <TextBlock FontWeight="{Binding Change, Converter={StaticResource changefontweight}}"

                                                   Text="{Binding Symbol}"/>

                                    </DataTemplate>

                                </syncfusion:GridTemplateColumn.CellTemplate>

                            </syncfusion:GridTemplateColumn>

 

Code Snippet(C#):

internal class ChangeFontWeight : IValueConverter

    {

        object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo info)

        {

           if(Convert.ToInt32(value)>=0)

                return FontWeights.Bold;

            else

                return FontWeights.Normal;

        }

 

        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo info)

        {

            throw new NotImplementedException();

        }

    }

 

 

Regards,

Farjana Parveen A

 


Attachment: PerformanceDemo_6d58be84.zip

Loader.
Live Chat Icon For mobile
Up arrow icon