PropertyGrid Contol localized DisplayName

G

Guest

I'm Using the PropertyGrid Contol , and have a requirement to display a
localized property name.

Therefore My Classes Implement ICustomTypeDescriptor, and return a custom
PropertyDescriptor Collection,

The issues is that in the Derived PropertyDescriptor object when overriding
the "DisplayName" property it causes the PropertyGrid to call the
"DisplayName" Property an inordinate number of times, which then makes the
PropertyGrid, very slow and unusable.

code Snippet

ICustomTypeDescriptor.

public PropertyDescriptorCollection GetProperties(Attribute[] attributes) {

..Returns new PropertyDescriptorCollection containing MyPropertyDescriptor
objects

}

public class MyPropertyDescriptor : PropertyDescriptor

public override string DisplayName {

get{return "Overriden DisplayName"}

}

Worth mentioning, if I comment out the DisplayName Override Property

And run the code, then the grid functions as usual?

Any one have any idea's why DisplayName gets called again and again, and how
to prevent it?

Cheers

Brett
 
Y

Ying-Shen Yu[MSFT]

Hi Brett,
I'm investigating your problem, could you give me a small project to repro
your problem? I'll let you know as soon as I get some result.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

--------------------
| From: <[email protected]>
| Subject: PropertyGrid Contol localized DisplayName
| Date: Fri, 24 Oct 2003 16:12:33 +0100
| Lines: 42
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: no-dns-yet.demon.co.uk 195.173.8.133
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:55186
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| I'm Using the PropertyGrid Contol , and have a requirement to display a
| localized property name.
|
| Therefore My Classes Implement ICustomTypeDescriptor, and return a custom
| PropertyDescriptor Collection,
|
| The issues is that in the Derived PropertyDescriptor object when
overriding
| the "DisplayName" property it causes the PropertyGrid to call the
| "DisplayName" Property an inordinate number of times, which then makes the
| PropertyGrid, very slow and unusable.
|
| code Snippet
|
| ICustomTypeDescriptor.
|
| public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
|
| .Returns new PropertyDescriptorCollection containing MyPropertyDescriptor
| objects
|
| }
|
| public class MyPropertyDescriptor : PropertyDescriptor
|
| public override string DisplayName {
|
| get{return "Overriden DisplayName"}
|
| }
|
| Worth mentioning, if I comment out the DisplayName Override Property
|
| And run the code, then the grid functions as usual?
|
| Any one have any idea's why DisplayName gets called again and again, and
how
| to prevent it?
|
| Cheers
|
| Brett
|
|
|
 
Y

Ying-Shen Yu[MSFT]

Hi,
I apologize for the long delay, I wrote a small program to repro your
problem.
but unfortunately, this problem didn't occurred on my machine when I just
returns a string object.
Does this problem still exists if the DisplayName property of your derived
propertydescriptor only returns a string?
If this works , could you show me some snippet of your PropertyDescriptor
class?

If you have any updates to this problem , please let me know.
Thanks!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

--------------------
| From: <[email protected]>
| Subject: PropertyGrid Contol localized DisplayName
| Date: Fri, 24 Oct 2003 16:12:33 +0100
| Lines: 42
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: no-dns-yet.demon.co.uk 195.173.8.133
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:55186
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| I'm Using the PropertyGrid Contol , and have a requirement to display a
| localized property name.
|
| Therefore My Classes Implement ICustomTypeDescriptor, and return a custom
| PropertyDescriptor Collection,
|
| The issues is that in the Derived PropertyDescriptor object when
overriding
| the "DisplayName" property it causes the PropertyGrid to call the
| "DisplayName" Property an inordinate number of times, which then makes the
| PropertyGrid, very slow and unusable.
|
| code Snippet
|
| ICustomTypeDescriptor.
|
| public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
|
| .Returns new PropertyDescriptorCollection containing MyPropertyDescriptor
| objects
|
| }
|
| public class MyPropertyDescriptor : PropertyDescriptor
|
| public override string DisplayName {
|
| get{return "Overriden DisplayName"}
|
| }
|
| Worth mentioning, if I comment out the DisplayName Override Property
|
| And run the code, then the grid functions as usual?
|
| Any one have any idea's why DisplayName gets called again and again, and
how
| to prevent it?
|
| Cheers
|
| Brett
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top