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

Clearing a grid

Thread ID:

Created:

Updated:

Platform:

Replies:

141801 Jan 4,2019 03:06 PM UTC Jan 7,2019 08:40 AM UTC WPF 2
loading
Tags: GridControl
Jonathan Bleeker
Asked On January 4, 2019 03:06 PM UTC

Hi

How does one clear a Grid control in WPF? Preferably in a way to reset it to what it was when it first initialized. The WinForms ClearCells method doesn't seem to exist in the GridControl in WPF.

Arulraj A [Syncfusion]
Replied On January 7, 2019 07:03 AM UTC

Hi Jonathan, 
 
Thanks for using Syncfusion products.  
 
The GridControl works on how you define the styles, either through QueryCellInfo or manually setting those styles.  
 
  1. Through QueryCellInfo, you would have an underlying store, which you could simply set it to NULL and reset the Model.RowCount and Model.ColumnCount.
  2. Manually applying styles, then you can clear the internal lists maintained in the Model as,
this.gridControl.Model.VolatileCellStyles.Clear(); 
this.gridControl.Model.Data.Clear(); 
this.gridControl.InvalidateCells(); 
 
 
 
Please let us know if you need any further assistance on this. 

Arulraj A 


Jonathan
Replied On January 7, 2019 08:40 AM UTC

Thanks. The first option solved it.

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.

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

;