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

RadComboBox BindingOperations.GetBindingExpression

1 Answer 110 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Robbe Morris
Top achievements
Rank 1
Robbe Morris asked on 08 May 2012, 11:51 PM

How does one grab the binding in order to force an update on a RadComboBox control?

MyRadComboBox.ItemsSource = MyObservableCollectionOfACustomClass;
MyRadComboBox.DisplayMemberPath = "Description";



Then, I try to grab the binding in a different control's event.

var binding = BindingOperations.GetBindingExpression(MyRadComboBox, RadComboBox.ItemsSourceProperty);

 

if (binding == null) return;  // This is always null

 

binding.UpdateTarget();

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 11 May 2012, 08:13 AM
Hello Robbe,

It seems like there is no binding set.

MyRadComboBox.ItemsSource = MyObservableCollectionOfACustomClass;

The code above just give a source to the ItemsSource, but it doesn't set any binding.

var binding = BindingOperations.GetBindingExpression(MyRadComboBox, RadComboBox.ItemsSourceProperty);

So when the the above is used it is normal that the binding is null.
I have attached a simple project where you can see how when binding is set the binding variable is not null.

Kind regards,
Georgi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ComboBox
Asked by
Robbe Morris
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or