RadComboBox BindingOperations.GetBindingExpression

2 posts, 0 answers
  1. Robbe Morris
    Robbe Morris avatar
    25 posts
    Member since:
    Apr 2004

    Posted 08 May 2012 Link to this post

    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();

  2. Georgi
    Admin
    Georgi avatar
    349 posts

    Posted 11 May 2012 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top