This is a migrated thread and some comments may be shown as answers.

Controls and INotifyPropertyChanged

2 Answers 311 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 17 Sep 2010, 01:31 PM
Hi,

Most of the Windows Forms controls in Telerik implement the System.ComponentModel.INotifyPropertyChanged interface though I have noticed that it does not seem to fire whenever a property changes value.  I have noticed this in RadTextBox (Text property) and in RadDropDownList (SelectedValue property); I have not checked the other controls. 

Yes, these controls do have more specific events that fire when their value changes (TextChanged or SelectedValueChanged) but in the case of our project it is simpler to use the INotifyPropertyChanged.PropertyChanged event.

Questions:
1) Is it possible to know which control properties do fire the PropertyChanged event?
2) Are the implementations of INotifyPropertyChanged only designed to work for certain properties?

I cannot remember but I'm pretty sure previous releases used to fire this event and this only occurred with the latest release.

Thank you.

2 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 22 Sep 2010, 08:21 PM
Hello Mark,

Thank you for writing.

Basically, all property changes fire the PropertyChanged event. However, this event is fired at the base element that has this property exposed. Depending on the structure of a RadControl, the properties that you can see exposed at this RadControl may only be shortcuts, but not the original properties. So you should not expect to get the PropertyChanged event fired at the control, but you should expect to get it fired at the element that has the original property exposed. We do not have a certain specification and a list describing which property is a core property at which element since these specifics highly vary on the different purposes (hence structures) of the controls.

In regards to the RadDropDownList control, generally you should be able to get the PropertyChange fired with SelectedValue arguments at the ListElement:
public Form1()
{
    InitializeComponent();
  
    this.radDropDownList1.ListElement.PropertyChanged += new PropertyChangedEventHandler(ListElement_PropertyChanged);
}
  
void ListElement_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
    if (e.PropertyName == "SelectedValue")
    {
        // do sth here
    }
}

However, currently we have an issue which will prevent you from experiencing this behavior. We will address it in the upcoming major release Q3 2010.

I hope this information answers your questions.

Regards,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 28 Sep 2010, 02:16 PM
Hi Stefan,

Thank you for the additional details regarding PropertyChanged. 

We have decided to alter our code to subscribe to the appropriate event(s) of each control instead of relying on PropertyChanged as a "catch-all" event.  It would definitely be great if any future release would expand on PropertyChanged.

-Mark
Tags
General Discussions
Asked by
Mark
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Mark
Top achievements
Rank 1
Share this question
or