DataGridView images

0
0

Hi,

Up to now I have inserted images in a DataGridViewImageColumn using the DataGridViewBindingComplete event and setting the Value property of the corresponding cell to a string containing the name of the desired imagesource.

A couple of questions:

  1. In fact, there is an ImageSource property for the DataGridViewImageColumn itself. However, setting it to a value, e.g. “table-row-editing” (either from the column editor or in code) , has no effect. What is its purpose?
  2. continuing from 1… When I set the ImageSource property in the column editor, where is it stored? It is not in the Window1.Designer.cs file for sure!
  3. If I want to add a DataGridViewButtonColumn, containing a button with a small image on it, is this possible? The DataGridViewButtonColumn or the DataGridViewButtonCell do not have any Image(Source) property. I tried to get hold of the DataGridViewButtonCell[x].Control object (which I thought it would be the button) but its is null

Please advise.

Thanks,
Alex

  • You must to post comments
0
0

Hi Alex:

  1. The DGVImageColumn.Image values are the default values for all the cells. If you set an image there it will be shown on all the cells in the column and overridden by the individual cell if they have a value. But it doesn’t work correctly… Fixed in the current dev build.
  2. It should be serialized like all other properties.
  3. Button cells are not real buttons. All cells in a datagrid are not widgets, they are dynamically rendered html elements. The buttons are simply styled using css from the theme.  You can add an image using the Style.BackgroundImage properties. See screenshot below. There are some fixed in this area as well in the current dev build where the default image alignment was not the same on the server and the client.

Best,

Luca

 

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.