I just found myself creating a composite control where I wanted to expose several properties of controls placed on my usercontrol as if they were properties of the control I was constructing.
Specifically, I was trying to expose the contextmenu properties of several controls Through names like ListContext, TreeContext etc.
Code for this runs something like
Property ListContext()
As ContextMenu
Get
Return SomeListBox.ContextMenu
End Get
SomeListBox.ContextMenu = Value
End Set
End Property
There is nothing so special about the code above. It read and writes to the same place. But if you have dozens of these properties. you code can get a bit unwieldy.
Hows about a new language feature in Vb.Net and if anyone thinks it would be useful, In c# aswell.
Property ListContext Exposes SomeListBox.ContextMenu
And the Readonly version
Property Readonly ListContext Exposes SomeListBox.ContextMenu
I think this would make code an aweful lot easier to read and manage.
If needed we could even have a feature to expand this new syntax into the old syntax.
The phrase 'Old Syntax' is of course completely unfair.
Clearly we still need the 'Old Syntax' for properties which are not as straight forward as detailed above.
but hopefully this idea is both simple and useful
Comments please
Rory
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.