DataGridView

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am trying to add additional property to all the DataGridViewCell types by
implementing a Decorator pattern. For that I need to access protected members
in the base class(because most of the virtual methods in the DataGridViewCell
are protected) through an instance of the Base class in my Decorator class
which is also derived from Base class. What could be an alternative for this
problem?

Thanks for any help in advance.
 
Well, rather than how you are trying to do it... what are you trying to
accomplish?

Marc
 
I want to add a new property to all the cell types without implementing in
each cell type. For eg: I want to use the DataGridViewTextBoxCell without
deriving from it, but with the new property.

Manju
 
That still doesn't say anything about what you are trying to achieve, which
could influence the design... however...

I don't think you are going to apply that to all instances very easily...

however, a viable option might be to declare a class to hold all the extra
data you need, and simply assign that to the Tag property. It will involve a
cast to get from the (object) Tag to your class, but it will work. Of
course, if you are only ever going to want to add 1 property, you could use
the Tag directly to hold the value.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top