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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add PropertyChanged to inheritable class

Thread ID:

Created:

Updated:

Platform:

Replies:

127806 Dec 9,2016 04:38 PM UTC Dec 12,2016 05:14 AM UTC WPF 2
loading
Tags: SfKanban
Andrei Alfritovich Bilalov
Asked On December 9, 2016 04:38 PM UTC

Hello.

My class inherits from the class KanbanViewModel.

It has the variable property "BackgroundColor". How can I hang on him "PropertyChanged"?

public class KanbanViewModel : KanbanModel
{
    private Brush _backgroundColor;
    public Brush BackgroundColor
    {
        get { return _backgroundColor; }
        set
        {
 
           ???
        }
 
    }
}

Andrei Alfritovich Bilalov
Replied On December 11, 2016 07:15 AM UTC

My problem - I can't use INotifyProperyChanged, because KanbanModel already implement this interface.

Satheesh Kumar T [Syncfusion]
Replied On December 12, 2016 05:14 AM UTC

Hi Andrei, 

Thanks for contacting Syncfusion Support. 

We can notify the property changed for the property in the class which inherits the KanbanModel class. Please refer the below code sample to notify the property changed. 

Code sample: 

[C#] 

 
public class KanbanViewModel : KanbanModel 
{ 
       private MethodInfo _methodInfo; 
 
       private Brush _backgroundColor; 
 
       public Brush BackgroundColor 
       { 
              get { return _backgroundColor; } 
              set 
              { 
                     _backgroundColor = value; 
                     if (_methodInfo != null) 
                           _methodInfo.Invoke(this, new object[] { "BackgroundColor" }); 
              } 
       } 
               
       public KanbanViewModel() 
       { 
              //Reflected the NotifyPropertyChanged method.  
              _methodInfo = this.GetType().GetMethod("NotifyPropertyChanged", BindingFlags.NonPublic | BindingFlags.Instance); 
       } 
} 


Thanks, 
Satheesh  


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

;