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

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

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;
customerUserControlNewDataTemplate.Seal();

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

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


1 Reply

KB Kanimozhi Bharathi Syncfusion Team 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.

 

Thanks

Kanimozhi B


Attachment: CustomRenderer_Sample1474809702_4c545183.zip

Loader.
Live Chat Icon For mobile
Up arrow icon