How to create a button with an inline close button

I am trying to create a panel that will have a set of "buttons".

These buttons should have the following behavior:

  • Similar to a tag (with rounded edges)
  • Contains red drag to remove the filter / tag from the panel, similar to how Internet explorer tabs have a built-in cross to close a separate tab.
  • allows the user to click on the tag and react as normal (until the click is in the red cross)

Number 1 is not a problem, it is just appearance, however, regarding numbers 2 and 3, I'm not sure if there is code that does something like this ... and I really don't want to reinvent the wheel if I can avoid it!

My question is, does anyone know if there is something out there in infragistics that will make this simple, or would I have to write this myself by subclassing the winform buttons?

Thanks in advance!

+1


a source to share


3 answers


Is this a new development or maintenance of an existing project?

If this is a service, you have a slightly tougher time ahead. You implement UserControl

, perhaps segmented into two buttons. Use docking to get the most correct behavior. The button on the far right will contain your cross image; the left one (which should automatically expand when the control is resized) will contain your main button behavior. Play with visual styles until you get them right (EG, removing borders, etc.).



If this is a new development and you are not too into it, you can use Windows Presentation Framework (WPF) instead of WinForms. It will be easier to create a control and get it to look exactly the way you want it to. WPF includes an extremely powerful composition control system that allows you to place multiple controls on top of each other and work with them exactly as you'd expect, and this adds the added benefit of allowing complete visual control over the appearance.

Anyway, this is more than disabling the external component ... I have been using Infragistics for many years and I cannot think of anything comparable between them. The closest one, but only if you are building an MDI application and these controls are for navigating windows are MDI tabbed window management tools - and there are only tabs (which replace the window title bars) have this behavior.

+1


a source


I don't think infraredistics can do something like that. The UltraButton control cannot. Implementing your own control would not be that difficult.



0


a source


you may need to make a suit for this type of job.

0


a source







All Articles