Disabled control in a DataGridView cell

From time to time you need to show a disabled control within DataGridView control. As you might already know, a grid cell has ReadOnly property which is not useful for the case because controls still looks enabled even if they are placed in disabled cell.
The good thing is that the way to get it exists. The bad thing is that we should paint the control on our own.

There is an example of such customization on MSDN: How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control

In order to update column’s cell value related to another cell without changing selection position in a grid I implemented CurrentCellDirtyStateChanged event of the grid. The full source code you can find in my Git: http://github.com/xtrmstep/DisabledControlInDataGridView/


Tags: ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Post

%d bloggers like this: