I have a progress bar which is nested control and I want to persist
the design time properties of this nested control. I thought all I
needed to do was mark it with the
DesignerSerializationVisibility.Content attribute, as below:

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public ProgressBar ProgressBar
{
get{return _progressBar;}
set{_progressBar = value;}
}

but for some reason the properies are not being persisted, has anyone
got any ideas what I doing wrong?

thanks
andrew
www.vbusers.com

Re: Problem Persisting a nested control using the DesignerSerializationVisibility attribute by Claes

Claes
Mon Aug 09 03:40:10 CDT 2004

Make the property read-only

/claes

"Andrew Baker" <webmaster@vbusers.com> wrote in message
news:c19b84e5.0408050720.78654255@posting.google.com...
> I have a progress bar which is nested control and I want to persist
> the design time properties of this nested control. I thought all I
> needed to do was mark it with the
> DesignerSerializationVisibility.Content attribute, as below:
>
> [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
> public ProgressBar ProgressBar
> {
> get{return _progressBar;}
> set{_progressBar = value;}
> }
>
> but for some reason the properies are not being persisted, has anyone
> got any ideas what I doing wrong?
>
> thanks
> andrew
> www.vbusers.com



Re: Problem Persisting a nested control using the DesignerSerializationVisibility attribute by webmaster

webmaster
Tue Aug 10 03:37:06 CDT 2004

Marvellous, thanks v. much!

I scanned the only MS doc I could find at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custcodegen.asp,
but couldn't find anything about making it readonly. Is there a
particular reason why it has to be read-only?

thanks again
andrew
www.vbusers.com

"Claes Bergefall" <claes.bergefall@online.nospam> wrote in message news:<esM48xefEHA.1424@tk2msftngp13.phx.gbl>...
> Make the property read-only
>
> /claes
>
> "Andrew Baker" <webmaster@vbusers.com> wrote in message
> news:c19b84e5.0408050720.78654255@posting.google.com...
> > I have a progress bar which is nested control and I want to persist
> > the design time properties of this nested control. I thought all I
> > needed to do was mark it with the
> > DesignerSerializationVisibility.Content attribute, as below:
> >
> > [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
> > public ProgressBar ProgressBar
> > {
> > get{return _progressBar;}
> > set{_progressBar = value;}
> > }
> >
> > but for some reason the properies are not being persisted, has anyone
> > got any ideas what I doing wrong?
> >
> > thanks
> > andrew
> > www.vbusers.com

Re: Problem Persisting a nested control using the DesignerSerializationVisibility attribute by Claes

Claes
Tue Aug 10 03:53:45 CDT 2004

No particular reason, just plain sense

Think about it. Why would you want to allow the user
to exchange your internal instance of the progressbar
for another one (which you'll allow by making it read-write)?
You want to expose the internal progressbar so that
the user can manipulate *its* properties, not exchange
it completely.

If the progressbar was inheritable and you provided
a read-write property, the user could exhange it with
whatever weird control they've made so that your code
wouldn't work anymore. Your code relies on the fact
that the control is an instance of a specific class, not
something derived from it.


/claes

"Andrew Baker" <webmaster@vbusers.com> wrote in message
news:c19b84e5.0408100037.d0a69cf@posting.google.com...
> Marvellous, thanks v. much!
>
> I scanned the only MS doc I could find at
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custcodegen.asp,
> but couldn't find anything about making it readonly. Is there a
> particular reason why it has to be read-only?
>
> thanks again
> andrew
> www.vbusers.com
>
> "Claes Bergefall" <claes.bergefall@online.nospam> wrote in message
news:<esM48xefEHA.1424@tk2msftngp13.phx.gbl>...
> > Make the property read-only
> >
> > /claes
> >
> > "Andrew Baker" <webmaster@vbusers.com> wrote in message
> > news:c19b84e5.0408050720.78654255@posting.google.com...
> > > I have a progress bar which is nested control and I want to persist
> > > the design time properties of this nested control. I thought all I
> > > needed to do was mark it with the
> > > DesignerSerializationVisibility.Content attribute, as below:
> > >
> > >
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
> > > public ProgressBar ProgressBar
> > > {
> > > get{return _progressBar;}
> > > set{_progressBar = value;}
> > > }
> > >
> > > but for some reason the properies are not being persisted, has anyone
> > > got any ideas what I doing wrong?
> > >
> > > thanks
> > > andrew
> > > www.vbusers.com



Re: Problem Persisting a nested control using the DesignerSerializationVisibility attribute by webmaster

webmaster
Wed Aug 11 04:23:13 CDT 2004

I guess so...

My original thought was that I wanted to deliberately allow the user
to swap the progress bar to any weird and wonderful derived control
that they may have made. Since as long as it supported the same
properties, I didn't really care how they had customised it... Having
said this, it's just a progress bar, so who cares!!!

:)

thanks claes,
andrew

PS. Can't actually believe it still doesn't expose a backcolor and
forecolor/bar color. Had to resort to sendmessage to change it (see
link below 4 details)!

http://www.vbusers.com/codecsharp/codeget.asp?ThreadID=36&PostID=1&NumReplies=0


"Claes Bergefall" <claes.bergefall@online.nospam> wrote in message news:<OEw8MerfEHA.3320@TK2MSFTNGP11.phx.gbl>...
> No particular reason, just plain sense
>
> Think about it. Why would you want to allow the user
> to exchange your internal instance of the progressbar
> for another one (which you'll allow by making it read-write)?
> You want to expose the internal progressbar so that
> the user can manipulate *its* properties, not exchange
> it completely.
>
> If the progressbar was inheritable and you provided
> a read-write property, the user could exhange it with
> whatever weird control they've made so that your code
> wouldn't work anymore. Your code relies on the fact
> that the control is an instance of a specific class, not
> something derived from it.
>
>
> /claes
>
> "Andrew Baker" <webmaster@vbusers.com> wrote in message
> news:c19b84e5.0408100037.d0a69cf@posting.google.com...
> > Marvellous, thanks v. much!
> >
> > I scanned the only MS doc I could find at
> >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custcodegen.asp,
> > but couldn't find anything about making it readonly. Is there a
> > particular reason why it has to be read-only?
> >
> > thanks again
> > andrew
> > www.vbusers.com
> >
> > "Claes Bergefall" <claes.bergefall@online.nospam> wrote in message
> news:<esM48xefEHA.1424@tk2msftngp13.phx.gbl>...
> > > Make the property read-only
> > >
> > > /claes
> > >
> > > "Andrew Baker" <webmaster@vbusers.com> wrote in message
> > > news:c19b84e5.0408050720.78654255@posting.google.com...
> > > > I have a progress bar which is nested control and I want to persist
> > > > the design time properties of this nested control. I thought all I
> > > > needed to do was mark it with the
> > > > DesignerSerializationVisibility.Content attribute, as below:
> > > >
> > > >
> [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
> > > > public ProgressBar ProgressBar
> > > > {
> > > > get{return _progressBar;}
> > > > set{_progressBar = value;}
> > > > }
> > > >
> > > > but for some reason the properies are not being persisted, has anyone
> > > > got any ideas what I doing wrong?
> > > >
> > > > thanks
> > > > andrew
> > > > www.vbusers.com