• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 548
  • Last Modified:

I am looking for the right WPF control - Which one and then how?

Hi all.

I have a list of strings that I need to present to the user for them to choose one.  Say for example it contains the following content and is presented in a similar way.

cat
dog
  Basset Hound
  German Shepherd
  Beagle
  Poodle
bird
fish
  Shark
  Cod
  Salmon

You can see that there are 2 levels for some and potentially 2 levels for them all.  But Also I would like to be able to choose for example Dog.

I know I could just make a combobox with a collection of string and have a string of value "   Poodle" which would mean (because of the spaces in the string) it is indented, but I was hoping for a little nicer solution.

What type of WPF control should I use.  I need some kind of dropdown system as I have limited space, but I suppose a popup if that is even possible would be ok.  

What I am kinda thinking is that I need what looks like a textbox or combobox when closed.  User clicks on the right hand side and a list (mybe a treeview appears) then when a choice is made that choice is added to the textbox.
0
darbid73
Asked:
darbid73
  • 3
2 Solutions
 
darbid73Author Commented:
Hi CodeCruiser,

Yes I saw this and that is why the name is in my tags.

My first hope was something a little simpler.  Maybe a re-style of a combobox.

Maybe a grouped Combobox where the group header could be selected and not ever entry had to be grouped.
0
 
Jaime OlivaresCommented:
I would recommend not to use a tree view for a 2-level case. Treeviews are tricky and hard to implement.
A single-level listbox or combobox with some indent for "2nd level" items would be enough.
0
 
darbid73Author Commented:
I am tending to agree with you jaime - which is what I put in my opening question about putting some space or indent into the data.

This guy also concluded that.

Sometimes the trick is to know the right words.  In my case the right words are "hierarchical combobox"  It appears that such data is really only suitable for a Treeview and you must "flatten it to put it into a combobox.
0
 
darbid73Author Commented:
Thank you guys.

I think both solutions are correct, but must agree that my case is simple and thus practically I should just be doing the simple solution.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now