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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cell value with complex properties is not updated after edit until reload the page

Thread ID:

Created:

Updated:

Platform:

Replies:

150720 Jan 17,2020 02:44 AM UTC Jan 20,2020 02:22 PM UTC Xamarin.Forms 3
loading
Tags: SfDataGrid
Yin Shun
Asked On January 17, 2020 09:38 AM UTC

Hi,

  Thanks for providing this awesome plugin=)!

  I have memtioned the member of orderdetails and its updated member raised the property change event and return a correct updated value to the binding       model(OrderinfoViewModel). But the cell value is not be updated after edit until reload the page.

  For example : 

  The class "OrderInfo" contains a class "OrderDetails"(for example, serveral simple datatype members) which is defined.

  And column is generated manually ( AutoGenerateColumns="False")

  How to accomplish this scenario:)?

  
   

Balasubramani Sundaram [Syncfusion]
Replied On January 17, 2020 02:00 PM UTC

Hi yin, 
 
Thank you for contacting Syncfusion support.   
 
Based on your provide details we have analysis the issue and we suspect that maybe you have missed to implement the INotifyPropertyChanged on your underline collection. “INotifyPropertyChanged” Which is helps to update the collection and property at runtime. 
 
If you bound the complex property, the changes will not reflect in UI so we must to implement the NotificationObject to respective property to reflect the changes in view. For both implementation we have provided the codes in below code snippet please refer in it.  
 
Please refer the sample, UG and code snippet,  
 
Code snippet [C#] 
 
 
public class OrderInfo : INotifyPropertyChanged 
{ 
    private int? orderID; 
   
    private CustomerInfo customersinfo; 
 
    //Complex Property 
    public event PropertyChangedEventHandler PropertyChanged; 
 
    private void RaisePropertyChanged(String Name) 
    { 
        if (PropertyChanged != null) 
            this.PropertyChanged(this, new PropertyChangedEventArgs(Name)); 
    } 
 
    public int? OrderID 
    { 
        get { return orderID; } 
        set { this.orderID = value; RaisePropertyChanged("OrderID"); } 
    } 
 
    //Complex Property 
    public CustomerInfo CustomersInfo 
    { 
        get { return customersinfo; } 
        set 
        { 
            this.customersinfo = value; 
            RaisePropertyChanged("CustomersInfo"); 
            this.CustomersInfo.PropertyChanged += CustomersInfo_PropertyChanged; 
        } 
    } 
 
    private void CustomersInfo_PropertyChanged(object sender, PropertyChangedEventArgs e) 
    { 
        RaisePropertyChanged("CustomersInfo." + e.PropertyName); 
    } 
 
    public OrderInfo() 
    { 
    } 
} 
 
public class CustomerInfo : NotificationObject 
{ 
    private string firstName; 
 
    public string FirstName 
    { 
        get { return firstName; } 
        set 
        { 
            this.firstName = value; 
            RaisePropertyChanged("FirstName"); 
        } 
    } 
} 
 
 
 
 
 
We hope this helps. Please let us know, if you need any further assistance. 
 
Regards,
Balasubramani Sundaram.
 
 


Yin Shun
Replied On January 17, 2020 04:33 PM UTC

Hi Balasubramani Sundaram,

  Thanks for your demo and clear to me what's the problem is!
  I missed the registration of the PropertyChanged event on the complex mode=D!

  And now I have one more question 

   //Complex Property 
    public CustomerInfo CustomersInfo 
    { 
        get { return customersinfo; } 
        set 
        { 
            this.customersinfo = value;
           RaisePropertyChanged("CustomersInfo");     // What's the point to keep this line?
            this.CustomersInfo.PropertyChanged += CustomersInfo_PropertyChanged;  // This event seems handle it, isn't it?
        } 
    } 

   Thanks again!

Best Regards,
Jason

  

Karthikraja Kalaimani [Syncfusion]
Replied On January 20, 2020 02:22 PM UTC

Hi Yin Shun,

Sorry for the inconvenience caused. 
No need to call RaisePropertyChanged method on ComplexProperty we have called by mistakenly.

Regards,
Karthik Raja


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon