Robin,
Yes you are right .It s happenning because of the base object Prefilter
call overwrites original Properities..
If you save the original, call base , remove design time and restore
original ,it will work.
The second approch is more complex. It is implementing CustomProperty
descriptor..
protected override void PreFilterProperties(System.Collections.IDictionary
properties)
{
//Save objects runtime property before base call overrite it
PropertyDescriptor pdObject = properties["GridSize"] as
PropertyDescriptor ;
// Fill design time properties
base.PreFilterProperties (properties);
//Restore runtime property
properties["GridSize"] = pdObject;
}
[quoted text, click to view] "Robin Sanner" <robin.h.sanner@verizon.net> wrote in message
news:OW0RBQqSFHA.3548@TK2MSFTNGP10.phx.gbl...
> That gets rid of the design time GridSize property but I still can't see
> the GridSize property that is on my control.
>
> "Mujdat Dinc" <mujdat.dinc@gmail.com> wrote in message
> news:%23SRSPLzRFHA.2788@TK2MSFTNGP09.phx.gbl...
>> Hi Robin..
>> Try this..
>> // Your designers override code
>> protected override void
>> PreFilterProperties(System.Collections.IDictionary properties)
>> {
>> base.PreFilterProperties (properties);
>> PropertyDescriptor pd = properties["GridSize"] as PropertyDescriptor ;
>> if(pd != null && pd.DesignTimeOnly )
>> properties.Remove("GridSize");
>> }
>>
>> Mujdat
>>
>> "Robin Sanner" <robin.h.sanner@verizon.net> wrote in message
>> news:Ox23UkSPFHA.3356@TK2MSFTNGP12.phx.gbl...
>>>I have a new custom control. By default the custom control has the
>>>design-time property GridSize. I want my custom control to have it's own
>>>GridSize property that works in both design time and in run time and be
>>>browsable in design-time. I used PostFilterProperties to get rid of the
>>>original GridSize property but how do I retrieve the property descriptor
>>>for the GridSize property on my control? If I try to use
>>>TypeDescriptor.GetProperties(mycontrol)("GridSize") it causes
>>>PostFilterProperties to run again and creates a stack overflow situation.
>>>
>>> Thank you
>>> Robin Sanner
>>> robin.sanner@verizon.net
>>>
>>
>>
>
>