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.
Platform : WPF
|
Category : Annotations

How do I override the DataGridViewTextBox.Clone method ? In general, how do I implement ICloneable in a derived class ?

When the DataGridView needs to create a new cell in the column the method DataGridViewTextBoxCell.Clone is called in order to duplicate the ’DataGridViewColumn.CellTemplate’. It’s perfectly logical.

You can override the Clone method, but you can’t call base.Clone() since it returns an object of the base class type and you can’t code a copy constructor because there is no copy constructor for DataGridViewTextBoxCell.

With a base copy constructor you could code a Clone method like this :

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.