Get DataFormComboBoxField selected item?

4 posts, 1 answers
  1. Austin
    Austin avatar
    10 posts
    Member since:
    Jan 2011

    Posted 23 Aug 2011 Link to this post

    Is there a way to get a DataFormComboBoxFields currently selected item?
  2. Answer
    Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 24 Aug 2011 Link to this post

    Hello Austin,

    The currently selected item in a regular case should be reflected in the bound property of your business object.
    For example if you have a combo field for choosing countries e.g. bound to the CountryID property of your business object ( DataMemberBinding = {Binding CountryID} ), then you can read the property( CountryID) itself.

    In case you have more complicated scenario , please give some more details so we can think of some solution . 

    All the best,
    Pavel Pavlov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Austin
    Austin avatar
    10 posts
    Member since:
    Jan 2011

    Posted 24 Aug 2011 Link to this post

    This certainly helped me, but I have another related issue.

    If I take the DataMemberBinding value (In your example CountryID, which is also the DataFormComboBoxField's SelectedValuePath) and change it, I expect to see the ComboBox change it's selection. This is what occurs when I edit the bound value through the DataForm, and all is good - but if I manually change the CountryID value through the code behind, I see no changes in the DataForm on either the ComboBox or the CountryID field. Naively I attempted to DataForm.UpdateLayout, but I'm obviously missing something here, as no matter what I seem to do in the code behind I can't get the DataForm to recognize the new CountryID value.

    Any suggestions?

    Edit: I've corrected this issue myself through INotifyPropertyChanged
  5. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 25 Aug 2011 Link to this post

    Hello Austin,

    Glad to know you have solved the issues.Yes  , indeed  the INotifyPropertyChanged is the recommended way.

    All the best,
    Pavel Pavlov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top