c# - Add property to non user defined classes -


we use controls time example button , may want add custom properties button. example numberoftimesclicked etc. working gridviewcolumnheader , add property columnindex class. know can keep track of columns other methods curios know if can add properties classes. example thinking inheritance. if create new class , inherit class want add new properties (in case gridviewcolumnheader) think should work reason errors in code whenever like:

private class mygridviewcolumnheader : gridviewcolumnheader {     public int propertythatiwanttoadd { get; set; } } 

from on if instantiate objects mygridviewcolumnheader class instead of gridviewcolumnheader class errors. wrong using inheritance achieve this?

instead of casting sender object use

e.originalsource mygridviewcolumnheader 

and work on object. if need know inside routedeventargs have on msdn


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -