Only tooltip on cells with value

Hello

In one of my column I have a tooltip with the value and it looks ok when there is a value. But is there any way to make the toltip to show only if there is a value (not empty string) in the cell?

                <syncfusion:GridDataVisibleColumn MappingName="Note"
                                                  HeaderText="{Binding Source={x:Static prop:Resources.frmCountyInvoicing_ColNote}}"
                                                  IsReadOnly="False">
                    <syncfusion:GridDataVisibleColumn.ColumnStyle>
                        <syncfusion:GridDataColumnStyle CellType="TextBlock"
                                                        ShowTooltip="True"
                                                        TooltipTemplateKey="noteTooltip" Description="Note">
                        </syncfusion:GridDataColumnStyle>
                    </syncfusion:GridDataVisibleColumn.ColumnStyle>
                </syncfusion:GridDataVisibleColumn>


        <DataTemplate x:Key="noteTooltip">
            <Border BorderThickness="1"
                    BorderBrush="Black"
                    Background="#D7C6C5FF"
                    CornerRadius="2">
                <StackPanel Margin="5"
                            Orientation="Horizontal">
                    <TextBlock Text="{Binding CellValue}"></TextBlock>
                </StackPanel>
            </Border>
        </DataTemplate>


Thanx for any help

/Marcus

1 Reply

RS Ravi Shankar B Syncfusion Team November 30, 2012 10:13 AM UTC

Hi Marcus,

 

Thanks for using Syncfusion products.

We have analyzed your query and you can achieve this by handling QueryCellInfo event in code behind and check the cell value and to set the tooltip as follows.

C# code snippet:

 void Model_QueryCellInfo(object sender, Syncfusion.Windows.Controls.Grid.GridQueryCellInfoEventArgs e)

        {

            if (e != null)

            {

                if (e.Style.CellValue != "")

                {

                    e.Style.ShowTooltip = true;

                    e.Style.TooltipTemplateKey = "noteTooltip";

                }

            }

 

 

We have created simple sample for this and you can download the sample from following location.

Sample Link: Tooltip.zip

 

Regards,

Ravi Shankar B.


Loader.
Up arrow icon