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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Conditional formatting update on row item PropertyChanged

Thread ID:

Created:

Updated:

Platform:

Replies:

108133 Apr 4,2013 10:13 PM UTC May 20,2014 12:02 PM UTC WPF 3
loading
Tags: GridDataControl
Ivan Eryshov
Asked On April 4, 2013 10:13 PM UTC

I show tasks in the grid. When the status of some task is updated (Task.Status property with changing/changed notifications, etc.) the condition might be satisfied and style should be updated, but it does not work (styles do not change) until I click on the updated row. How to make it work as I expected?

Thangapriya V [Syncfusion]
Replied On April 11, 2013 06:57 AM UTC

Hi Ivan,

If you update any property and want to apply styles for the other cells in the row using conditional format, you need to set RefreshWholeRow API to True. Please refer the following code snippet for this.

Code Snippet[C#]:

public MainWindow()

{

InitializeComponent();

this.dataGrid.Model.RefreshWholeRow = true;

}

And please make sure that INotifyPropertyChanged is used and NotifyPropertyChanges is enabled.

You can refer the following UG link for this.

http://help.syncfusion.com/ug/wpf/grid/default.htm#!Documents/tableoptions.htm

Please let us know if you have any queries.

Regards,

Thangapriya


Sankar Sekar
Replied On May 9, 2014 04:34 AM UTC

Hi Ivan,

If you update any property and want to apply styles for the other cells in the row using conditional format, you need to set RefreshWholeRow API to True. Please refer the following code snippet for this.

Code Snippet[C#]:

public MainWindow()

{

InitializeComponent();

this.dataGrid.Model.RefreshWholeRow = true;

}

And please make sure that INotifyPropertyChanged is used and NotifyPropertyChanges is enabled.

You can refer the following UG link for this.

http://help.syncfusion.com/ug/wpf/grid/default.htm#!Documents/tableoptions.htm

Please let us know if you have any queries.

Regards,

Thangapriya


XAML
 <syncfusion:GridDataControl Name="ImportDataGrid"
                                        AllowEdit="true"
                                        AllowSelection="Cell"
                                        AutoFocusCurrentItem="True"         
                                        AutoPopulateColumns="False"
                                        AutoPopulateRelations="False"
                                        ColumnSizer="Star"
                                        NotifyPropertyChanges="True"
                                        ShowAddNewRow="False"
                                        Background="DarkGray"        
                                        UpdateMode="PropertyChanged"
                                        VisualStyle="Metro"        
                                        VerticalAlignment="Stretch"
                                        HorizontalAlignment="Stretch"                                                                                  
                                        ScrollViewer.VerticalScrollBarVisibility="Auto"                                                                       
                                        ItemsSource="{Binding PersonCollection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">




            <!--  Columns  -->
            <syncfusion:GridDataControl.VisibleColumns>
                <!--Selection Column-->
                <syncfusion:GridDataVisibleColumn  HeaderText="Name" IsReadOnly="False" Binding="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" >
                    <syncfusion:GridDataVisibleColumn.ColumnStyle>
                        <syncfusion:GridDataColumnStyle Background="White" IsThreeState="False" HorizontalAlignment="Center"/>
                    </syncfusion:GridDataVisibleColumn.ColumnStyle>
                    <syncfusion:GridDataVisibleColumn.HeaderStyle>
                        <syncfusion:GridDataColumnStyle HorizontalAlignment="Center" />
                    </syncfusion:GridDataVisibleColumn.HeaderStyle>
                </syncfusion:GridDataVisibleColumn>
                <!--Timer Name Column -->
                <syncfusion:GridDataVisibleColumn Width="Auto" IsReadOnly="True" Binding="{Binding Address, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" HeaderText="Address">
                    <syncfusion:GridDataVisibleColumn.ColumnStyle>
                        <syncfusion:GridDataColumnStyle HorizontalAlignment="Center" Background="White"/>
                    </syncfusion:GridDataVisibleColumn.ColumnStyle>
                    <syncfusion:GridDataVisibleColumn.HeaderStyle>
                        <syncfusion:GridDataColumnStyle HorizontalAlignment="Center" />
                    </syncfusion:GridDataVisibleColumn.HeaderStyle>
                </syncfusion:GridDataVisibleColumn>
            </syncfusion:GridDataControl.VisibleColumns>

            <syncfusion:GridDataControl.Relations >
                    <syncfusion:GridDataRelation  RelationalColumn="ProductList"  >
                    <syncfusion:GridDataRelation.TableProperties>
                        <syncfusion:GridDataTableProperties AutoPopulateColumns="False"                                                                                                                                        
                                                            ShowAddNewRow="False"     
                                                            ColumnSizer="Star"
                                                            UpdateMode="PropertyChanged"
                                                            HideEmptyChildGrid="False"   
                                                            AutoPopulateRelations="False"    
                                                            ShowRecordPlusMinus="True"  
                                                            NotifyComplexPropertyChanges="True"
                                                            NotifyPropertyChanges="True"
                                                            DefaultHeaderRowHeight="50">

                                <syncfusion:GridDataTableProperties.ConditionalFormats>

                                    <syncfusion:GridDataConditionalFormat Name="conditionJobFailedRed" ApplyStyleToColumn="ProductDetails">

                                        <syncfusion:GridDataConditionalFormat.Style>
                                            <syncfusion:GridDataStyleInfo Foreground="Red" />
                                        </syncfusion:GridDataConditionalFormat.Style>

                                        <syncfusion:GridDataConditionalFormat.Conditions>
                                            <syncfusion:GridDataCondition ColumnName="ProductDetails" Value="TestModiifcation" />
                                        </syncfusion:GridDataConditionalFormat.Conditions>

                                    </syncfusion:GridDataConditionalFormat>

                                    <syncfusion:GridDataConditionalFormat Name="conditionInprogressYellow" ApplyStyleToColumn="ProductDetails">

                                        <syncfusion:GridDataConditionalFormat.Style>
                                            <syncfusion:GridDataStyleInfo Foreground="Yellow"/>
                                        </syncfusion:GridDataConditionalFormat.Style>

                                        <syncfusion:GridDataConditionalFormat.Conditions>
                                            <syncfusion:GridDataCondition ColumnName="ProductDetails" Value="dfgfdsgfds" />
                                        </syncfusion:GridDataConditionalFormat.Conditions>

                                    </syncfusion:GridDataConditionalFormat>

                                    <syncfusion:GridDataConditionalFormat Name="conditionNoDataSuccessGreen" ApplyStyleToColumn="ProductDetails">

                                        <syncfusion:GridDataConditionalFormat.Style>
                                            <syncfusion:GridDataStyleInfo Foreground="Green"/>
                                        </syncfusion:GridDataConditionalFormat.Style>

                                        <syncfusion:GridDataConditionalFormat.Conditions>
                                            <syncfusion:GridDataCondition ColumnName="ProductDetails" Value="afsfdsfdsfds" />
                                            <syncfusion:GridDataCondition ColumnName="ProductDetails" Value="dfgfdsgfds" />

                                        </syncfusion:GridDataConditionalFormat.Conditions>

                                    </syncfusion:GridDataConditionalFormat>

                                </syncfusion:GridDataTableProperties.ConditionalFormats>
                                <syncfusion:GridDataTableProperties.VisibleColumns>
                                <syncfusion:GridDataVisibleColumn  HeaderText="ProductName" IsReadOnly="True" MappingName="ProductName">
                                    <syncfusion:GridDataVisibleColumn.ColumnStyle>
                                        <syncfusion:GridDataColumnStyle  HorizontalAlignment="Left" />
                                    </syncfusion:GridDataVisibleColumn.ColumnStyle>
                                </syncfusion:GridDataVisibleColumn>
                                <syncfusion:GridDataVisibleColumn HeaderText="ProductDetails" IsReadOnly="True" MappingName="ProductDetails" AllowSort="False"
                                                                  UpdateMode="PropertyChanged">

                                    <syncfusion:GridDataVisibleColumn.HeaderStyle>
                                        <syncfusion:GridDataColumnStyle HorizontalAlignment="Left" />
                                    </syncfusion:GridDataVisibleColumn.HeaderStyle>
                                    <syncfusion:GridDataVisibleColumn.ColumnStyle>
                                        <syncfusion:GridDataColumnStyle HorizontalAlignment="Left" />
                                    </syncfusion:GridDataVisibleColumn.ColumnStyle>

                                </syncfusion:GridDataVisibleColumn>
                                <syncfusion:GridDataVisibleColumn MappingName="IsActive" IsHidden="True"  />
                            </syncfusion:GridDataTableProperties.VisibleColumns>
                        </syncfusion:GridDataTableProperties>
                    </syncfusion:GridDataRelation.TableProperties>

                </syncfusion:GridDataRelation>
            </syncfusion:GridDataControl.Relations>


        </syncfusion:GridDataControl>


Problem:
 the Relations is not updating the ProductDetails value due to the Conditional Formatting eventhough i have written this line of code
  public MainWindow()
        {
            InitializeComponent();
            this.ImportDataGrid.Model.RefreshWholeRow = true;
        }
<syncfusion:GridDataControl.Relations >
                    <syncfusion:GridDataRelation  RelationalColumn="ProductList"  >

Please let me know how to overcome this problem,if there is no conditionalFormatting it is working fine.

Akila Rajaram [Syncfusion]
Replied On May 20, 2014 12:02 PM UTC

Hi  Sankar,

 

We could not understand your requirement clearly. If you want to refer the row based on condition using Conditional formatting for NestedGird then you have achieve your requirement by setting RefreshWholeRow property to true for ChildModel as in the below code,

 

public MainWindow()

        {

            InitializeComponent();

            this.dataGrid.Model.RefreshWholeRow = true;

            this.dataGrid.Model.Table.RecordExpanded += Table_RecordExpanded;

        }

 

void Table_RecordExpanded(object sender, GridDataValueEventArgs<GridDataRecord> e)

        {

            e.Value.ChildModels[0].RefreshWholeRow = true;

        }

 

If your requirement is different from the above one then please revert us with more details that will help us to provide better solution to meet your requirement.

 

Please refer the below attached sample.

 

Please let us know if you have any questions.

 

Regards,

Akila                


Attachment: sample_d1fa56db.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;