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.

OnPropertyChanged and live data update delay in SfDataGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

128419 Jan 20,2017 03:12 AM Jan 24,2017 03:25 PM WPF 1
loading
Tags: SfDataGrid
Martin Tichovsky
Asked On January 20, 2017 03:12 AM

Hello,

I have problem with live data update in SfDataGrid. In attachment is example with three tables. If is changed one cell of column "A" in "Table 2", and click away from cell, then click to other cell is delayed. This problem is caused with OnPropertChanged evenet with changing multiple columns at once. Imagine, in real i have twenty tables, hundreds of columns, and data with tables / columns are joined, or recalculated. Then if i change one cell, i need to recalculate multiple columns in others tables (in others tabs).

In this case with SfDataGrid is problem this option LiveDataUpdateMode="AllowDataShaping". If is this option removed from SfDataGrid, then reclick delay is very short. I suppose this problem is with recalculating summaries. If is summaries removed from SfDataGrid (or option LiveDataUpdateMode), then live data changing in table works normally.

Thank you for help
Martin

Attachment: TestWPF_new_e267c17e.zip

Sivakumar R [Syncfusion]
Replied On January 24, 2017 03:25 PM

Hi Martin, 
 
We have analyzed the provided sample and performance of summary calculating can be optimized using INotifyPropertyChanging and INotifyPropertyChanged. Below documentation explains the same. 
 
In your sample, you have implemented the interfaced but not in the right way where SfDataGrid can listen to notification and performance summary calculation optimistically.  
For example, Before changing the property you have to call PropertyChanging event, So SfDataGrid will know the property going to be changed and store its previous value internally. After changing the value, you have to trigger PropertyChanged event, So now SfDataGrid recalculates the summary based on old value and new value optimistically without reading entire column of values. 
public double? A 
{ 
    get { return A_; } 
    set 
    { 
        //Raising property changing before it gets changed to backup the old value 
        this.MultiPropertyChanging("A"); 
        A_ = value; 
        this.MultiPropertyChanged("A"); 
 
        this.UpdateProperty("D", "E", "F", "G", "H", "I", "J", "K"); 
        //this.MultiPropertyChanging("D", "E", "F", "G", "H", "I", "J", "K"); 
        //this.MultiPropertyChanged("D", "E", "F", "G", "H", "I", "J", "K"); 
        if (Table1 != null) 
        { 
            Table1.OnPropertyChanged("A"); 
            Table1.OnPropertyChanging("A"); 
        } 
    } 
} 
 
In the same way, Other properties D, E, F, G, H, I, J, K changed to optimistically calculate the summary. 
internal void UpdateProperty(params string[] Prop) 
{ 
    foreach (var propertyName in Prop) 
    { 
        if(propertyName == "D") 
            D = A + B; 
        if (propertyName == "E") 
            E = A + C; 
        if (propertyName == "F") 
            F = D + E; 
        if (propertyName == "G") 
            G = F + C; 
        if (propertyName == "H") 
            H = F + G; 
        if (propertyName == "I") 
            I = G + H; 
        if (propertyName == "J") 
            J = E + I; 
        if (propertyName == "K") 
            K = I + J; 
    } 
} 
 
private double? D_; 
public double? D 
{ 
    get { return D_; } 
    set 
    { 
        OnPropertyChanging("D"); 
        D_ = value; 
        OnPropertyChanged("D"); 
    } 
    //get { return A + B; } 
} 
 
Please find the modified sample below, 
 
Thanks, 
Sivakumar 


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.

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.

;