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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Is it possible to add a placeholder in the filter cell?

Thread ID:





131975 Aug 6,2017 10:29 PM UTC Feb 13,2018 01:15 PM UTC WPF 3
Tags: GridDataControl
Carlos Fernando Consigli
Asked On August 6, 2017 10:29 PM UTC

I'm using a GridDataControl with FilterBarMode=Immediate. Is it possible to add a "Placehoder" like "Type to filter" or "Type to search" in the filter cell? It would be a grey text that disappears as soon as you start typing there.
I haven't found it in the documentation but I may be searching it wrongly.
Thanks in advance

Balamurugan Rajaraman [Syncfusion]
Replied On August 8, 2017 11:58 AM UTC

Hi Carlos 
Thanks for contacting Syncfusion support. 
We have checked your query “To add a placeholder in the filter cell”. You can able to achieve your requirement by customizing the OnRender method of the GridDataFilterBarCellRenderer as like the below provide code sample. 
this.dataGrid.Model.CellModels.Add("FilterBarCell", new GridFilterBarCellModelExt()); 
. . .  
public class GridFilterBarCellModelExt : GridCellModel<GridCellTextBoxRendererExt> 
public class GridCellTextBoxRendererExt: GridDataFilterBarCellRenderer 
public GridCellTextBoxRendererExt():base() 
protected override void OnRender(DrawingContext dc, RenderCellArgs rca, GridRenderStyleInfo style) 
    if (rca.CellUIElements != null) 
    var margins = style.TextMargins.ToThickness(); 
    if (style.HasImageIndex) 
        margins = style.AdjustImageWidthAndHeightToMargin(margins, rca.CellRect.Size); 
        margins = style.ErrorInfo.AdjustErrorInfoMargin(margins, rca.CellRect.Size); 
    Rect textRectangle = rca.SubtractBorderMargins(rca.CellRect, margins); 
    if (textRectangle.IsEmpty) 
    margins.Left = Math.Max(margins.Left, 2); 
    margins.Right = Math.Max(margins.Right, 2); 
    string text = GetControlText(style); 
    if (text == string.Empty) 
        text = "Type to filter"; 
    GridTextBoxPaint.DrawText(dc, textRectangle, text, style); 
In this sample we have applied the custom test in the OnRender to display that text as like the placeholder text. We have attached the sample for your reference you can able to get it from below link 
Balamurugan R 

Carlos Fernando Consigli
Replied On February 12, 2018 11:15 PM UTC

I'm really REALLY sorry about my lack of feedback on this. It was a minor request and it was postponed and almost forgotten.
It worked perfectly, thanks a lot for your help.

Muthukumar Kalyanasundaram [Syncfusion]
Replied On February 13, 2018 01:15 PM UTC

Hi Carlos, 
You are welcome. Please let us know if you need further assistance. 
Muthukumar K 


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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