PropertyChanged always null in whole application

2 posts, 0 answers
  1. Michele
    Michele avatar
    426 posts
    Member since:
    Jun 2009

    Posted 26 Jun 2012 Link to this post

    Hello,
    I've got a SL4 application I've been developing for almost 3 years... I've got a strange and weird problem.... all times I try to bind a class that implements INotifyPropertyChanged I got null on the event that should notify the change....

    I've cross checked my code, copied the code from another working app... I don't know what's wrong

    Here's my code

    public partial class AnnullaQuestionarioUC : RadWindow, INotifyPropertyChanged
        {
     
            public event PropertyChangedEventHandler PropertyChanged;
     
            public void NotifyPropertyChanged(string propertyName)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                }
            }
     
    private ObservableCollection<TipoAnnulloObj> listaTipoAnnullamento;
            public ObservableCollection<TipoAnnulloObj> ListaTipoAnnullamento
            {
                get
                {
                    return listaTipoAnnullamento;
                }
                set
                {
                    listaTipoAnnullamento = value;
                    NotifyPropertyChanged("ListaTipoAnnullamento");
                }
            }
    //[omitt]
    }

    Since it's happening in the entire application what can went wrong?
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1218 posts

    Posted 27 Jun 2012 Link to this post

    Hi Paolo,

    The implementation illustrated on the snippet seems to be right. I believe that the source of this issue does not lay there. Would you please check your code for some of the following cases: Binding to a CLR property, which is somewhere else modified through its private field. Or maybe you have a duplicate instance of AnnullaQuestionarioUC (i.e. having simultaneously a binding that uses a static resource instance of AnnullaQuestionarioUCas a Source and a DataContext for the same element with a value of AnnullaQuestionarioUC?). In case that you have not found anything particularly suspicious, feel free to send us a runnable project that isolates the issue, so that we would be able to debug it on our side.

    Kind regards,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top