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

InvalidateCell() doesn't work, but InvalidateCells() works well

Thread ID:





117621 Nov 18,2014 04:16 AM UTC Nov 19,2014 07:00 PM UTC WPF 1
Tags: GridControl
Nick Tang
Asked On November 18, 2014 04:16 AM UTC

I add one customer user control into one cell, when the cell is activated, the customer user control should be displayed, when the cell is deactivated, the cell just display as text block.
The problem is when activated the cell, the customer user control is not displayed in the activated cell, must call gridControl. InvalidateCells().
I tried all InvalidateCell() methods, none works .

gridControl.InvalidateCell( CellSpanInfoBase span );
gridControl.InvalidateCell( GridRangeInfo gridRangeInfo );
gridControl.InvalidateCell( RowColumnIndex cellRowColumnIndex );
gridControl.InvalidateRenderCell( GridRangeInfo range );

gridControl.Model.InvalidateCell( CellSpanInfoBase span );
gridControl.Model.InvalidateCell( GridRangeInfo gridRangeInfo );
gridControl.Model.InvalidateCell( RowColumnIndex cellRowColumnIndex );

gridControl.Model.InvalidateVisual ()

gridControl. InvalidateCells() consume too much time. Is there any good method to resolve the problem?

Following is my source code:

CustomerUserControl customerUserControl = new CustomerUserControl ();

gridControl.Model[ rowIndex, columnIndex ].BeginUpdate();

Binding binding = new Binding();
binding.Source = customerUserControl;

FrameworkElementFactory customerUserControlFactory = new FrameworkElementFactory( typeof( customerUserControlTemplate ) );
customerUserControlFactory.SetBinding( CustomerUserControlTemplate.CustomerUserControlProperty, binding );

DataTemplate customerUserControlNewDataTemplate = new DataTemplate();
customerUserControlNewDataTemplate.DataType = typeof( CustomerUserControlTemplate );
customerUserControlNewDataTemplate.VisualTree = customerUserControlFactory;

gridControl.Model[ rowIndex, columnIndex ].CellEditTemplate = customerUserControlNewDataTemplate;

gridControl.Model[ rowIndex, columnIndex ].EndUpdate();
gridControl.InvalidateCells(); //Consume too much time

Kanimozhi Bharathi [Syncfusion]
Replied On November 19, 2014 07:00 PM UTC

Hi Nick,


Thank you for contacting Syncfusion Support.


We have analysed your query. You can activate the template of the cell while editing by setting CellType  and  CellEditTemplateKey in QueryCellInfoEvent like the below snippet


Code Snippet


void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)



e.Style.CellType = "CustomCellType";

e.Style.CellEditTemplateKey = "CustomTemplate";




We have also prepared a sample based on your requirement. Please find the below link for your reference.


Please let us know if you have any queries.



Kanimozhi B

Attachment: CustomRenderer_Sample1474809702_4c545183.zip


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

This page will automatically be redirected to the 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