PresentationCore.dll Hogging CPU!

jwh

Well-known member
Joined
Aug 18, 2006
Messages
155
Programming Experience
3-5
I have an application that creates a number of Buttons on a canvas, and then sets them all to invisible.

Unfortunately it seems that as soon as the appliaction has loaded these buttons, my cpu maxes out for a good few minutes.

I know it is related to these buttons because if I comment out the procedure that loads these buttons, the cpu doesn't budge.

I have concluded ( by using process explorer and the visual studio call stack) that the problem is something to do with presentationcore.dll.

Attached is a screenshot of my call stack, as you can see, it seems to be something also to do with setting the visibility of the buttons, however if I skip this step it makes no difference.

Has anybody experienced this or got any suggestions?
 

Attachments

  • callstack.JPG
    callstack.JPG
    238.2 KB · Views: 33
OK, it seems now that is is just directly relative to the number of wpf buttons I have on the form, regardless of whether they are visible or hidden.

However; if they are Collapsed (Windows.Visibility.Collapsed) then all is good, and it doesn't hog the resources.

Long story short; Use collapsed rather than hidden, unless you absolutely have to reserve the space your hidden control is using ( eg in a stack panel)
 
Back
Top