High CPU Load with BusyIndicator + Transition + Missing Images

2 posts, 0 answers
  1. Carsten Jendro
    Carsten Jendro avatar
    8 posts
    Member since:
    Jul 2009

    Posted 06 Jan 2011 Link to this post

    I have a strange behavior in a Silverlight Application.

    I had very high CPU load in an application that makes nearly nothing.

    i removed things from the app to find the error, at the and i had an application with
    - A BusyIndicator
    - A Transition Control
    - A UserControl
    - An image where the Source attribute points to am non existing Image.

    This is my main Page

    <UserControl x:Class="CpuLoadTest.MainPage" ...
        <Controls:RadBusyIndicator Name="busyIndicator">
            <Controls:RadTransitionControl Name="transition">
                <Controls:RadTransitionControl.Content>
                    <Button Margin="4" Click="Test">Test</Button>
                </Controls:RadTransitionControl.Content>
            </Controls:RadTransitionControl>
        </Controls:RadBusyIndicator>
    </UserControl>

    Busy Indicator, With a Transition Control in it and a Button

    this code is executed when the button is clicked:

    private void Test(object sender, RoutedEventArgs e)
    {
        busyIndicator.IsBusy = true;
         
        DispatcherTimer dt = new DispatcherTimer();
        dt.Interval = TimeSpan.FromSeconds(0.5);
        dt.Tick += (o, args) =>
                       {
                           dt.Stop();
                           busyIndicator.IsBusy = false;
                           var userControl = new UserControlWithMissingImage();
                           userControl.MouseLeftButtonDown += (sender1, eventArgs) =>
                                 {
                                         busyIndicator.IsIndeterminate = false;
                                 };
                           transition.Content = userControl;
                            
                       };
        dt.Start();
    }

    When the button is clicked, the busy indicator is busy for 0,5 seconds, then the button is replaced by a usercontrol.


    <UserControl x:Class="CpuLoadTest.UserControlWithMissingImage" ...
        <Grid x:Name="LayoutRoot" Background="Wheat">
            <Grid.Effect>
                <DropShadowEffect BlurRadius="7" Color="CornflowerBlue"  />
            </Grid.Effect>
            <Image Source="missing.jpg">
                <Image.Effect>
                    <DropShadowEffect BlurRadius="7" Color="CornflowerBlue"  />
                </Image.Effect>
            </Image>
        </Grid>
    </UserControl>

    when the usercontrol is shown, i have 35% cpu load on my Core i7 930 when the browser is maximized on my 1920*1200 screen, smaller size gives less cpu load.

    When i click on the usercontrol, the RadBusyControl.IsIndeterminate is set to false (i think this stops the animation on the INVISIBLE BusyControl)  cpu load changes to 0%

    this is repeatable on different computers.

    Is this an issue in the Telerik controls or in Silverlight itself?

    Whatever, it may be useful to stop the animation of the RadBusyControl when it is set to invisible.

    ps: Why cant i upload zip files with test projects?

    Greets, 

    Carsten
  2. Teodor
    Admin
    Teodor avatar
    501 posts

    Posted 07 Jan 2011 Link to this post

    Hi Carsten Jendro,

    Thank you for contacting us. 

    Looking at the code of your UserControl that replaces the Button, I can assume that it is very likely that the problem is caused by the DropShadowEffects used inside. In this relation, can you try running the application without the effects (comment them out or delete them)? In case this turns out to be the source of the issue, you might try to fix it using this technique - basically you should restructure your XAML so that all elements which have Effects applied do not have children.

    Finally, in order to be able to attach a sample project, you will need to open a new support ticket and do it there. Attachments are not available in forum tickets so feel free to send us a copy of your project in a support thread in case the issue persists.

    Hope this helps. Let us know in case you need further assistance.

    Regards,

    Teodor
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
Back to Top