ToolTip use with StackedHeaders

My initial SfDataGrid had ToolTips assigned to each HeaderRow cell and these were displayed correctly using the grid's ToolTipOpening event for RowIndex 0. I've now added a StackedHeader row and without any further changes the ToolTips revert to displaying the column name, rather than the text I specified. I found that by adding the StackedHeader row, the HeaderRow now has a RowIndex = 1. Therefore, changing the code in the ToolTipOpening event to reference RowIndex 1 the correct ToolTips are again being displayed (these are now the child columns). However, I don't seem to be able to set up ToolTips for the StackedHeader row (which may or may not be RowIndex 0 (?)). When positioning the mouse cursor over this upper portion of the StackedHeader, the ToolTipOpening event doesn't trigger. So, is there a way to display ToolTips for this element?


Regards


Jeremy


WinForms 18.4.0.39


3 Replies 1 reply marked as answer

MA Mohanram Anbukkarasu Syncfusion Team May 5, 2021 12:59 PM UTC

Hi Jeremy, 

Thanks for contacting Syncfusion support.  

SfDataGrid doesn’t have support to show tooltip for stacked headers. However you can achieve this requirement by using our SfToolTip as shown in the following code example.  

Code example

this.sfDataGrid1.TableControl.MouseMove += OnTableControl_MouseMove; 
 
RowColumnIndex hoveredRowcolumnIndex = new RowColumnIndex(-1, -1); 
SfToolTip Tooltip = new SfToolTip(); 
 
private void OnTableControl_MouseMove(object sender, MouseEventArgs e) 
{ 
    var rowColumnIndex = this.sfDataGrid1.TableControl.PointToCellRowColumnIndex(e.Location, true); 
    if(hoveredRowcolumnIndex != rowColumnIndex && rowColumnIndex.RowIndex == 0) 
    { 
        Tooltip.Hide(); 
        if (rowColumnIndex.ColumnIndex == 0) 
            Tooltip.Show("StackedHeaderCell 1"); 
        if (rowColumnIndex.ColumnIndex == 1) 
            Tooltip.Show("StackedHeaderCell 2"); 
        hoveredRowcolumnIndex = rowColumnIndex; 
    } 
} 


Please let us know if you require further assistance from us.  

Regards, 
Mohanram A. 


Marked as answer

JE Jeremy May 6, 2021 10:09 AM UTC

Thanks Mohanram.


I'll take a look at implementing this as soon as possible.



Regards


Jeremy


MA Mohanram Anbukkarasu Syncfusion Team May 7, 2021 07:27 AM UTC

Hi Jeremy, 

Thanks for the update.  

We will wait to hear from you. 

Regards, 
Mohanram A. 




Loader.
Up arrow icon