I would go for exposing text property of the child controls(labels):
public string HeaderText
{
get
{
return lblHeader.Text;
}
set
{
lblHeader.Text = value
}
}
simply because only "text" on the label is being changed. If you had to set
many properties of the same label (i.e. Text, Font, BackgroundColor) it would
be easier and quicker to expose Label as property (please note it does not
require setter because you want to allow control consumers to change label's
properties, not the actual reference):
public Label HeaderLabel
{
get
{
return lblHeader;
}
}
As you can see it depends on the purpose.
Hope it helps
--
Milosz
On the same note of exposing control properties, Here is a more complex
question that might require a little bit of coding on my part. I need to
have a web user control (just like the one above), except that it is fed its
values through a live website environment. In other words, it will be fed
its values through user input, objects and a few different dataSources. Do
you think I should make a different control for this part of the
application? or is it possible to extend the one above to include getting
its sources through other means besides the text property of a label
control. If it is possible to extend the control above so it doesn't have to
be rewritten, how would you hide the labels text properties and expose the
ones needed? I was thinking of a property of some kind, maybe like a
Control.Mode property that would determine if the control was in ConfirmView
or UserView. If it is in ConfirmView the label.text properties are exposed
and the other "live" dataSources are hidden. If it is in UserView, then the
label.text properties are hidden and the other datasource properties are
exposed. How hard would it be to do something like this? and how would you
do it? is there an article somewhere if it is complicated to do?
"Milosz Skalecki [MCAD]" <mil...@DONTLIKESPAMwp.pl> wrote in message
news:EE1D2391-FBBF-4434...@microsoft.com...