[Ironpython-users] description for a property

Keith Rome rome at Wintellect.com
Sun Dec 8 22:48:56 CET 2013


I think that you are giving an instance of System.Type to the property grid where you really want to be giving it an instance of your class. So it sees your method member of the dynamic Type and shows it. All members of dynamic types are seen as properties from the perspective of PropertyGrid. 


Keith Rome
Senior Consultant and Architect
MCPD-EAD, MCSD, MCDBA, MCTS-WPF, MCTS-TFS, MCTS-WSS

Wintellect | 770.617.4016 | krome at wintellect.com

www.wintellect.com

> On Dec 8, 2013, at 4:44 PM, "Lee Armeanu" <learmeanu at gmail.com> wrote:
> 
> Hi all,
> I am trying to populate a simple PropertyGrid, something in the lines:
> class Form1(System.Windows.Forms.Form):
> 
>     def __init__(self):
>         self.PropertyGrid1 = System.Windows.Forms.PropertyGrid()
>         ...
> 
>         ...
>         self.Load += self.Form1_Load
>         self.ResumeLayout(False)
> 
> 
>     def Form1_Load(self, sender, event_args):
>         self.PropertyGrid1.SelectedObject = Parrot()
> 
> class Parrot(object):
>     def __init__(self):
>         self._voltage = 100000
> 
>     @property
>     def voltage(self):
>         """Get the current voltage."""
>         return self._voltage
> I would expect that the description string """Get the current voltage.""" is shown below the grid section but only "voltage" is printed.
> Any suggestions?
> 
> Thanks,
> Lee
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> https://mail.python.org/mailman/listinfo/ironpython-users


More information about the Ironpython-users mailing list