winforms icon indicating copy to clipboard operation
winforms copied to clipboard

DataGridView's cell mouse tooltip does not display when the cell is not selected in specific case

Open Philip-Wang01 opened this issue 2 years ago • 3 comments

.NET version

.NET SDK 7.0.100-rc.1.22405.9

Did it work in .NET Framework?

No

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No, it's not a regression issue, also repro on .NET 6.0.

Steps to reproduce

  1. Open the attached solution: DGV_DataBind_ToolTip.zip
  2. Extract and open the project.
  3. Build and run the project.
  4. The DataGridView cell1 in row1 is selected by default, and the current row's cells have mouse tooltips, then hover with the mouse over next rows' cells to observe

Current Behavior

DataGridView's cell mouse tooltips does not display when the cell is not selected in step4 except the cell text is truncated test789415

Expected Behavior

DataGridView's cell mouse tooltips should always display because DataGridView's ShowCellTooloTips is True.

More Info

  1. The initial feedback ticket is: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1585331
  2. This issue may be caused by: https://github.com/dotnet/winforms/pull/1681
  3. This issue cannnot repro in DataGridView without dataBind
  4. .NET Framework does not support mouse tooltip.

Philip-Wang01 avatar Aug 08 '22 10:08 Philip-Wang01

@vladimir-krestov can you take a first look at this? @Philip-Wang01- what is the behavior in the Framework? Can you test back to 2.0?

merriemcgaw avatar Aug 10 '22 23:08 merriemcgaw

The docs are quite thorough, and it looks like we may have missed on of the cases - https://docs.microsoft.com/dotnet/api/system.windows.forms.datagridview.showcelltooltips.

RussKie avatar Aug 10 '22 23:08 RussKie

@merriemcgaw Here are the results of .NET Framework 2.0. .NET Framework 4.8 and 3.5 also have the same results. testframwork20 Framework20.zip

Philip-Wang01 avatar Aug 11 '22 07:08 Philip-Wang01

This issue is now marked as "help wanted", and we’re looking for a community volunteer to work on this issue. If we receive no interest in 180 days, we will close the issue. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

ghost avatar Aug 23 '22 21:08 ghost

@Philip-Wang01 , it is little ambiguous. Can you confirm if it was regression from .NET framework 2.0 ? or it was never an issue with .NET framework but only in .NET core?

dreddy-work avatar Aug 23 '22 21:08 dreddy-work

@dreddy-work This should be a regression issue in .NET Core, .NET framework is the expected result from the document. Thanks to @vladimir-krestov for the comment update and remove the relevant ambiguous information.

Philip-Wang01 avatar Aug 24 '22 01:08 Philip-Wang01

From the docs:

Remarks When the value of this property is true and the mouse pointer is over a cell or the user has navigated to the cell using the keyboard, the cell displays a ToolTip when one of the following conditions is met:

  1. The value of the DataSource property is not null or the value of the VirtualMode property is true, and a handler for the CellToolTipTextNeeded event sets the DataGridViewCellToolTipTextNeededEventArgs.ToolTipText property to a value other than String.Empty.
  2. The ToolTipText property of the cell has a value other than String.Empty. Setting this property has no effect when there is a CellToolTipTextNeeded event handler because getting the value of the property automatically raises the event and returns the ToolTip text specified in the event handler.
  3. The cell value is truncated in the cell display. When the value of the cell ToolTipText property value is String.Empty, the full value of the truncated cell value is displayed in the ToolTip.

So:

  1. DataGridView ToolTips work according to the documentation in .NET Framework 4.8.1 well.
  2. It doesn't work correctly in .NET, so it a regression. Investigating the reasons...

vladimir-krestov avatar Aug 24 '22 10:08 vladimir-krestov

Mouse tooltips work correctly in .NET Framework. #1681 added keyboard tooltips only, but it looks like it brought the regression

vladimir-krestov avatar Aug 24 '22 10:08 vladimir-krestov

Verified this issue in the latest .Net 8.0 SDK build: 8.0.100-alpha.1.22469.15, it is fixed. testrepari

Philip-Wang01 avatar Sep 20 '22 06:09 Philip-Wang01