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. Image for the cookie policy date

How to show the tooltip for filtertogglebutton in SfDataGrid - From 178541

It is very similar to first one. I want to add tooltip to these 2 filtertogglebutton. And each one must be different. 


1 Reply

VS Vijayarasan Sivanandham Syncfusion Team December 9, 2022 11:54 PM UTC

Hi Kivanc Yilmaz,

Your requirement to show the different tooltips for the filter toggle button in SfDataGrid by overriding the FilterToggleButton and customizing the ToolTipOpening event. Refer to the below code snippet,


XAML code snippet:

<!-- Customize the style of Filter icon -->

<Style  TargetType="{x:Type syncfusion:FilterToggleButton}">     

     <Setter Property="Foreground" Value="Red" />

     <!--Here defines the tooltip to trigger ToolTipOpening event for FilterToggleButton-->

     <Setter Property="ToolTip" Value=""  />

     <!--Event subscription for toolTip showing-->

     <EventSetter Event="ToolTipOpening"  Handler="OnFilterToggleButtonToolTipOpening" />     

 </Style>


C# code snippet:

//Event customization

private void OnFilterToggleButtonToolTipOpening(object sender, ToolTipEventArgs e)

{

    //Here get the FilterToogleButton

    var filterToggleButton = e.Source as FilterToggleButton;

 

    if (filterToggleButton != null)

    {

        //Here get the mouse hovering GridColumn

        var column = filterToggleButton.DataContext as GridColumn;

 

        if (column != null)

        {

            //Here customize the ToolTip based on different column

            if (column.MappingName == "OrderID")

            {

                filterToggleButton.ToolTip = "OrderID ToolTip";

            }

            else if (column.MappingName == "CustomerID")

            {

                filterToggleButton.ToolTip = "CustomerID ToolTip";

            }

            else

                //Here handle the ToolTip for other columns

                e.Handled = true;

        }

    }

}


UG Link:
https://help.syncfusion.com/wpf/datagrid/filtering#appearance-customization

https://help.syncfusion.com/wpf/datagrid/filtering#changing-filter-icon-style-after-applying-filters

KB Link: https://www.syncfusion.com/kb/2482/how-to-change-the-filtertogglebutton-color-while-filtering

Find the sample in the attachment.

Regards,

Vijayarasan S


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Sample_db34486c.zip

Loader.
Live Chat Icon For mobile
Up arrow icon