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

Conditional formatting - changing font style to BOLD

Hi, 

I am trying to add conditional formatting on the entire row whenever certain column value changes using GridDataStyleInfo. Weird thing is sometimes only one cell font changes and sometimes entire row font changes. I want to change the entire row font whenever certain column value in that row changes. 
Below is the code

   <syncfusion:GridDataControl.ConditionalFormats>
                        <syncfusion:GridDataConditionalFormat Name="C1" >
                            <syncfusion:GridDataConditionalFormat.Style>
                                <syncfusion:GridDataStyleInfo>
                                    <syncfusion:GridStyleInfo.Font>
                                        <syncfusion:GridFontInfo  FontWeight="Bold" />
                                    </syncfusion:GridStyleInfo.Font>                                                                                                   </syncfusion:GridDataStyleInfo>
                            </syncfusion:GridDataConditionalFormat.Style>
                            <syncfusion:GridDataConditionalFormat.Conditions>
                                <syncfusion:GridDataCondition ColumnName="SecurityfacilityList.IsDirty" ConditionType="Equals" Value="true" />
                                <syncfusion:GridDataCondition ColumnName="HasModifications" ConditionType="Equals" Value="true" />
                            </syncfusion:GridDataConditionalFormat.Conditions>

Please help !! 

Thanks
Swati


3 Replies

DA Divya A Syncfusion Team May 7, 2013 12:10 PM UTC

Hi Swati,

 

We have analyzed your query, the reported issue occurs when the row is not properly refreshed. You can overcome this by enabling the RefreshWholeRow Property as in the following code snippet.

 

Code Snippet:

 

 this.SyncGrid.Model.RefreshWholeRow = true;
 

Please let us know if you have any concern.

 

Regards,

Divya.



PP Permjeet Pandha January 6, 2014 04:50 PM UTC

I'm trying to do something similar using sfGrid on WinRT.

I have a dropdown column which offers a number of choices.
I want the row to change colour according to the dropdwn choice.
I have set up the RowStyleSelector and checked it gets called when the grid is first drawn.
My dropdown is selected and a new value chose for a row.
At this point I would expect to be able to refresh the grid to reapply the styles but I
cannot find a way to do it. I tried to do as you suggested in the previous reply:

     this.dataGrid.Model.RefreshWholeRow();

but the the dataGrid does not have a Model property. Here's some code fragments. Can you suggest a way to achieve this?

Thanks

Permjeet

<UserControl
    x:Class="CGI.xxx"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:storeApps="using:Microsoft.Practices.Prism.StoreApps"
    xmlns:notification="using:Syncfusion.UI.Xaml.Controls.Notification"
    xmlns:grid="using:Syncfusion.UI.Xaml.Grid"

    xmls:local="xyz"
    mc:Ignorable="d">
   

<UserControl.Resources>
        <ResourceDictionary>
            <local:IncludeTypes x:Key="includeTypesComboBox" />
            <local:CustomRowStyleSelector x:Key="rowStyleSelector" />
        </ResourceDictionary>
    </UserControl.Resources>
   
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <grid:SfDataGrid x:Name="dataGrid" AllowSorting="True" AllowEditing="True" NavigationMode="Cell" EditTrigger="OnTap"
                         ShowRowHeader="True" ItemsSource="{Binding Entities}"
                         SelectionMode="Single"  Grid.Row="1"
                         RowStyleSelector="{StaticResource rowStyleSelector}"
                         behaviours:DataGridCurrentCellEndEditCommandBehaviour.Command="{Binding CurrentCellEndEditCommand}">
            <grid:SfDataGrid.SortColumnDescriptions>
                <grid:SortColumnDescription ColumnName="Name" />
            </grid:SfDataGrid.SortColumnDescriptions>
            <grid:SfDataGrid.Columns>
                <grid:GridTextColumn HeaderText="Name" MappingName="Name" />
                <grid:GridComboBoxColumn ItemsSource="{StaticResource includeTypesComboBox}" MappingName="Include"/>
            </grid:SfDataGrid.Columns>
        </grid:SfDataGrid>
    </Grid>
</UserControl>

The class:
    public sealed partial class zzz: UserControl
    {
        public zzz()
        {
            this.InitializeComponent();
            this.dataGrid.Model.RefreshWholeRow();        }
    }




NJ Narayanasamy J Syncfusion Team January 9, 2014 03:23 AM UTC

Hi Permjeet,

 

Thanks for the updates,

 

We have analyzed your queries. We have prepared a simple sample based on your requirement and it can be downloaded from following location.

 

Sample: RowStyle.zip

 

Please let us know if you need further assistance.

 

Regards,

Narayanasamy


Loader.
Live Chat Icon For mobile
Up arrow icon