Jump to content

  • Log In with Google      Sign In   
  • Create Account

C# Custom Popup for DropDown.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Dave   Members   -  Reputation: 1528

Like
0Likes
Like

Posted 11 December 2012 - 07:56 AM

Afternoon,

I've googled and googled and found no solid answers on how to do this.

I basically want to provide a my own drop down selector control for the DropDown control. Failing that being possible i'll happily write my own usercontrol for this, that however led me on a complicated path for how to do your own popup functionality at all in .net with C#. The use-case is a dropdown that allows you to select an image from a pallette of images rather than just a list of file/image names. I also want to be able to filter the contents of the dropdown listview/image pallette differently to the standard way that the C# DropDown does it.

I have found the .net Popup class, it works but you're unable to assign a UserControl to the child field and so i won't be able to popup my more complicated palette view.

I have also seen solutions where a ToolStripDropDown was used, but that didn't allow me filter the contents of the view by typing in the textbox above it.

The solution i have at the moment is to fake it with a separate form but i get all sorts of issues to do with managing when it should be shown and hidden based on the focus states of the control that spawned it etc. Also, if i spawn it and then move the main application window it then ofcourse gets left behind.


Has anyone here managed this?

Thanks,

Sponsor:

#2 deathwearer   Members   -  Reputation: 367

Like
0Likes
Like

Posted 11 December 2012 - 09:59 AM

Hey,

First are you using WinForm or WPF?

Also what is the .NET version?

#3 Dave   Members   -  Reputation: 1528

Like
0Likes
Like

Posted 11 December 2012 - 11:05 AM

Winforms and .net 4.0

#4 unbird   Crossbones+   -  Reputation: 6016

Like
0Likes
Like

Posted 11 December 2012 - 11:54 AM

For a quick shot use a common ComboBox with DrawMode = OwnerDrawFixed and provide handlers for DrawItem and MeasureItem events.

This seems also a good starting point:
Creating a Custom DropDown Control.

You need a login to download the source, though, but Code Project is really resourceful.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS