views:

360

answers:

2

I have a Silverlight App that presents the user with a pretty straighforward form to fill in. The labels (TextBlocks) and the Fields (TextBoxes) are laid out in Grid as you might expect. We had a problem that when one TextBlock had its Opacity set to 0, the application would constantly re-render itself as verified by turning on the enableRedrawRegions parameter (very helpful BTW). This constant re-rendering would take the CPU usage up to 85% or so even though it was just a static form. We changed from setting the Opacity to 0 to setting the Visibility to Collapsed and fixing the height on the Grid RowDefinition so as not to alter the layout, and this stopped this behavior, and the CPU is now again at 0%.

At least this is true on a PC...But on a Mac, as soon as I open this form, my CPU usage goes to 24% (on an 8-core Mac Pro) and never moves back below that no matter what. Has anyone else ever seen a similar behavior? Any solutions? The application itself is not doing anything at all, just waiting for user input...

Carl

A: 

I have seen similar behaviour on mac but haven't figured out the reason. My image gallery view just takes ~20% cpu when the page is doing nothing. Sometimes the cpu drops when the user goes on different page and comes back but there is no clear pattern that could be reproduced. On windows this problem does not exist.

mmaier
One thing to try is to add this parameter to your silverlight html instantiation: <param name="enableRedrawRegions" value="true"/>This will cause the redraws to be shown. Then go through a lot of trial an error to see what is causing the constant redraws.
caryden
This is how we figured out the culprit on the PC side.
caryden
A: 

getting similar stuff on windows. Very complex pages. Its a nightmare.

James
on windows we were able to narrow it down using the enableRedraw Regions and a "binary" search - comment out half the XAML and see if CPU usage goes down...
caryden