On 7/17/06, Gregory Miley <[EMAIL PROTECTED]> wrote:
I've been through google a few times ^_^. Still on it actually.
And, yes, 2.0 - I'm not creating a control, I want to add, I guess it
would be best described as a, pseudo-property. I'm not quite sure how
.Net does it with the control I mentioned, but it would seem that it
actually stores the property information in the TableLayoutPanel control
and creates a property that appears to be part of the controls in the
TableLayoutPanel.Controls collection. For example, you create a
TableLayoutPanel instance on a form, then add a TextBox (named text1)
control to the TableLayoutPanel, you can now access text1.Cell or
text1.Column, etc... Even though that control never has those properties
on it, once it becomes a member of the TableLayoutPanel.Controls
collection it does.
Greg
-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Pardee, Roy
Sent: Monday, July 17, 2006 15:53
To: [email protected]
Subject: Re: Adding properties to child controls?
In the 1.1 world, you'd create a component w/a property decorated w/the
"ProvidePropertyAttribute", and you might also implement the
IExtenderProvider interface. Probably it's similar in the 2.0 world
(which I assume you're in, as I don't recognize the TableLayoutPanel
type). Hopefully a troll through the help docs and/or google will put
you on the scent.
HTH,
-Roy
-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Gregory Miley
Sent: Monday, July 17, 2006 12:40 PM
To: [email protected]
Subject: [ADVANCED-DOTNET] Adding properties to child controls?
I'm looking for some information on adding properties to child controls
similar to the way that TableLayoutPanel adds Cell, Column, Row,
ColumnSpan, and RowSpan to its child Controls. I would assume this is
possible since it is being done already.(?)
Basically, what I want is to add a bool property to controls added to a
form (the forms will be derived from a custom base form class). This
property will be used to determine if the control has a user-defined
default. I figured this would be a good way to handle it since a lot of
our forms use classes that dynamically generate their content based on
data in SQL tables, yet there can still be standard windows forms
controls mixed in that may or may not qualify as having user definable
default values.
It does that exactly as Roy explained - via IExtenderProvider and the
ProviderProperty attribute. Make that base custom form implement
IExtenderProvider interface, and have a hashtable or whatever to
persist the pseudo properties (DefaultValue or whatever you name it).
Cheers,
Stoyan
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com