FontAwesome.Sharp icon indicating copy to clipboard operation
FontAwesome.Sharp copied to clipboard

Icon button in datagridview

Open meszolym opened this issue 3 years ago • 7 comments

Is your feature request related to a problem? Please describe. N/A

Describe the solution you'd like I love icon buttons, and I'd love to use them in the datagridview control. I have two ideas, any of these would be fantastic in my opinion:

  • Just a copy of the existing DataGridViewButtonColumn / DataGridViewButtonCell, one button per column, with but not only text, also an icon could be added, just like with the IconButton control.
  • Something similar to this, which lets you add as many buttons as you like, but only with icons, no text.

Describe alternatives you've considered I was thinking about making it for myself, although this would be my first time doing something like this. Other than that, none.

Additional context These could be super useful to CRUDs!

meszolym avatar Jul 26 '22 15:07 meszolym

Some help may be found here: https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/how-to-host-controls-in-windows-forms-datagridview-cells?view=netframeworkdesktop-4.8

meszolym avatar Jul 26 '22 17:07 meszolym

Hi @iudexhun,

I see. DataGridView would be WinForms as well as DataGridViewButtonColumn. Pretty much using a special column with button-actions is a pretty good and common use case.

One could try the Text-property but this would be rather limited (font, colors, click-events, etc.).

Thanks for the idea. I will get back to you, once I have made up my mind about this. For now, adding a special DatagridViewButtonColumn seems like the way to go for WinForms.

mkoertgen avatar Jul 27 '22 08:07 mkoertgen

Would you be able to prepare a small demo app? Probably similar to the linked screenshot?

mkoertgen avatar Jul 27 '22 08:07 mkoertgen

Hi @mkoertgen, Sadly I am way too beginner to do this myself, but there are a couple of sources I have seen, I can link you some:

  • https://social.msdn.microsoft.com/Forums/en-US/c28399bb-9d50-4a1e-b671-3dbaebb5cc69/multiple-controls-in-a-single-datagridview-cell?forum=winformsdesigner
  • https://stackoverflow.com/questions/8955144/how-to-place-a-custom-control-within-a-cells-of-datagridview-in-window-form

Also, the photo I linked is from a web app, but having read the sources, what we're trying to achieve here is surely possible, I'm just not competent enough with winforms and c# to get this to work.

meszolym avatar Jul 27 '22 16:07 meszolym

Thank @iudexhun , I will probably come up with an example adding to the WinForms-Sample in this repo.

mkoertgen avatar Jul 28 '22 08:07 mkoertgen

This sounds really nice, thanks!

meszolym avatar Aug 16 '22 15:08 meszolym

Waiting for the example of DataGridViewIconButton[Cell|Column], @mkoertgen

WilliamQue avatar Jan 24 '23 15:01 WilliamQue