TreeView in Combobox - Existing Sample from Blog not working

2 posts, 1 answers
  1. Daniel Grünberger
    Daniel Grünberger avatar
    46 posts
    Member since:
    May 2008

    Posted 18 May 2015 Link to this post

    Hi,

    I'm trying to fit a TreeView into a Combobox. There are already many threads which all refer to this blog post:

    http://blogs.telerik.com/xamlteam/posts/10-05-12/treeview-in-combobox-with-radcontrols-for-silverlight-or-wpf-final-take.aspx

    Unfortunately, the example is not working (anymore?) in WPF.

    There seems to be a problem with the converter. In Silverlight, everything works fine, in WPF however, the converter is called, even when you open the DropDown (which does not happen in Silverlight). In this converter call, the "return false" condition is triggered and so the popup never opens. 

    Can you provide a new sample on how to fit a TreeView into a ComboBox (or DropDownButton)?

    Best regards 

     

  2. Answer
    Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 21 May 2015 Link to this post

    Hello Daniel,

    Indeed the converter doesn't work correctly for WPF - however we don't have a newer version of this example. What I can suggest you would be to manually close the drop down once the SelectedItem in the TreeView changes. You can do that in MVVM way by binding the SelectedItem and IsOpen to the ViewModel and changing the IsOpen whenever SelectedItem changes. Or you can simply hook to the SelectionChanged event and manually close the drop down:

    private void TreeView_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        this.DropDownButton.IsOpen = false
    }

    Hope this helps.

    Regards,
    Kalin
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top