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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

117621 Nov 17,2014 11:16 PM Nov 19,2014 02:00 PM WPF 1
loading
Tags: GridControl
Nick Tang
Asked On November 17, 2014 11:16 PM

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


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

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

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.

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.

;