Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Why is the PropertyDescriptor's GetValue method called multiple times when selecting the descriptor into the PropertyGrid?

Reply
Thread Tools

Why is the PropertyDescriptor's GetValue method called multiple times when selecting the descriptor into the PropertyGrid?

 
 
mark belles
Guest
Posts: n/a
 
      01-21-2004
i have a scenario in which i am using a ICustomTypeDescriptor in combination with an inherited PropertyDescriptor class to display information about an object using the PropertyGrid provided with .NET. I'm am using C#, and have noticed that the GetValue method which is overridden in my PropertyDescriptor class fires multiple times when the descriptor is placed into the SelectedObject property of the .NET PropertyGrid.

My 3 Questions are as follows...
Has anyone else noticed behavior like this?
Why does this occur?
How do I prevent it?

I will be happy to provide example code if anyone needs to see it.
 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      01-22-2004
"mark belles" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> i have a scenario in which i am using a ICustomTypeDescriptor in

combination with an inherited PropertyDescriptor class to display
information about an object using the PropertyGrid provided with .NET. I'm
am using C#, and have noticed that the GetValue method which is overridden
in my PropertyDescriptor class fires multiple times when the descriptor is
placed into the SelectedObject property of the .NET PropertyGrid.
>
> My 3 Questions are as follows...
> Has anyone else noticed behavior like this?
> Why does this occur?
> How do I prevent it?


I have no answer, but I have a question for you: why do you need to prevent
it? Surely GetValue should be idempotent...
--
John Saunders
John.Saunders at SurfControl.com


 
Reply With Quote
 
 
 
 
mark belles
Guest
Posts: n/a
 
      01-23-2004
why do i need to prevent it? it just seems terribly inefficient to watch the grid call into the descriptor so many times. i would think that once before drawing, and then perhaps again after changes to a property, assuming you raised the event using the change service. even displaying a single property in the grid, the getvalue method is called really frequently. usually twice everytime the thing paints, or before a UITypeEditor is shown. lol, so all in all it works yes, just bothers me and i want to know why?

it's like if i had a control that fired the paint event several times in succession for no apparent reason. Would that bother you, or at least strike an inquisitive bone so that you might have to ask? lol, anyways, it's apparently nothing i can control, so i'm not really worried, i'd still like to know tho.

 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      01-23-2004
"mark belles" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> why do i need to prevent it? it just seems terribly inefficient to watch

the grid call into the descriptor so many times. i would think that once
before drawing, and then perhaps again after changes to a property, assuming
you raised the event using the change service. even displaying a single
property in the grid, the getvalue method is called really frequently.
usually twice everytime the thing paints, or before a UITypeEditor is shown.
lol, so all in all it works yes, just bothers me and i want to know why?
>
> it's like if i had a control that fired the paint event several times in

succession for no apparent reason. Would that bother you, or at least strike
an inquisitive bone so that you might have to ask? lol, anyways, it's
apparently nothing i can control, so i'm not really worried, i'd still like
to know tho.


Actually, if I saw GetValue called multiple times, say, up to 10, or perhaps
up to 4*the number of objects in the property grid, then I'd assume there
was some reason for it that I simply didn't understand.

If I saw it called, say, 100*the number of objects, I'd wonder if it was a
bug.
--
John Saunders
John.Saunders at SurfControl.com


 
Reply With Quote
 
mark belles
Guest
Posts: n/a
 
      01-23-2004
i agree totally on the number of times called theory. i've already tried to figure out if it was related to the number of things i was showing, and it's not, it appears constant, give or take a call here and there. as far as i can tell, it's calling GetValue 7 times the first time the grid is loaded, this is up to the point i see the control, tracing with spy++ the first time until after the first paint message. it doesn't matter if i have 1 propertydescriptor or 50 in the grid, it's 7 calls for each. and then depending on the type of the property and uitypeeditor attached, anywhere from 2 to 6 calls again until after the editor is closed.

obviously this is by design, and obviously i don't get why, which is why i'm asking on here. lol odd eh?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session.Add method - what if called multiple times with the same k =?Utf-8?B?TWFydGlu?= ASP .Net 2 12-16-2011 12:44 PM
Simple sproc executes 240 times slower when called from asp.net thanwhen called from QA Radu ASP .Net 7 08-28-2009 09:09 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
three times copy ctor called, one ctor called, why? Apricot C++ 4 04-16-2004 07:55 AM
Why is the Constructor called 4 times but the Destructor 5 times? djskrill C++ 9 10-01-2003 07:18 PM



Advertisments