We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Only tooltip on cells with value

Thread ID:

Created:

Updated:

Platform:

Replies:

105291 Sep 26,2012 07:11 AM UTC Nov 30,2012 10:13 AM UTC WPF 1
loading
Tags: GridControl
Marcus Nilsson
Asked On September 26, 2012 07:11 AM UTC

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

Ravi Shankar B [Syncfusion]
Replied On 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.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;