how to manage two combobox if the items source of one depends on the other ?

4 posts, 0 answers
  1. ajoua taha
    ajoua taha avatar
    25 posts
    Member since:
    Feb 2016

    Posted 04 May Link to this post

    Hi,

    I have a DataForm in which there are two DataFormComboBoxField, one for the governorate and one for the delegation, and when I select a governorate in the first combo box, the ItemSource the 2nd combobox should contain the list of delagations that  belongs to the selected governorate.

    Thanks.

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 09 May Link to this post

    Hello,

    I prepared a sample project that illustrates how to achieve this behavior. You can find it attached to my post.

    Regards,
    Ivan Ivanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. ajoua taha
    ajoua taha avatar
    25 posts
    Member since:
    Feb 2016

    Posted 10 May Link to this post

    hi Ivan,

    Thank you for your reply, it was very beneficial, but is there a possibility to do things in view model instead of codebehind.

    thank you

  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1127 posts

    Posted 13 May Link to this post

    Hi,

    The suggested approach is purely event driven and it won't be easy to translate the event handlers to ViewModel commands, as class level event handler is used to process RadComboBox.SelectionChangedEvent occurrences. However, you can still remove this code from the view's code behind, by wrapping the logic in an attached behavior class.

    Regards,
    Ivan Ivanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top