TreeViewComboBox

0
0

Hi

Want is the best event to get the currently select node and its Tag Value?

From the Built in Tree View Combo Box

  • You must to post comments
0
0

Something like this?

https://drive.google.com/file/d/1Fk1YwLN86EfMwjyplhwuYtBJMxRZNsu1/view

You can do that with a UserComboBox. It’s easy:

  • Add UserComboBox (or create a class derived from UserComboBox)
  • Add a TreeView control and assign it to UserComboBox.DropDownControl.
  • Set the TreeView.Focusable property to false (or it will get the focus when dropping down)
  • Attach to UserComboBox.KeyDown event

Simple filter and auto drop down

 private void userComboBox1_KeyDown(object sender, KeyEventArgs e)
 {
   var text = this.userComboBox1.Text;
   this.userComboBox1.DroppedDown = true;

   this.treeView1.Nodes.ForEach(n =>
   {
    n.Visible = n.Text.IndexOf(text, StringComparison.OrdinalIgnoreCase) > -1;
   });
 }

Of course this is better done in a derived class.

  • You must to post comments
0
0

Hi Luca

Can you do a  wild card search based on text typed in the combo box?

 

  • You must to post comments
0
0

Try:

((TreeView)this.treeViewComboBox1.DropDownControl).SelectedNode.Tag.

 

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.