XAML Brushes and memory leaks

4 posts, 0 answers
  1. Christian
    Christian avatar
    52 posts
    Member since:
    Apr 2011

    Posted 18 Jan 2012 Link to this post

    Hi,
    why are Telerik brushes in XAML-Code not froozen? Potential memory leak?
    More here: http://blogs.msdn.com/b/jgoldb/archive/2008/02/04/finding-memory-leaks-in-wpf-based-applications.aspx 
  2. Pana
    Admin
    Pana avatar
    748 posts

    Posted 23 Jan 2012 Link to this post

    Hello,

    Do you experience a memory leak? They are not frozen so we can change them at Runtime. You should be able to freeze them by setting the MetroColors.PalletteInstance.Freeze(); Also in WPF4.0 they will be frozen once the "new MetroTheme()" is instantiated.

    Kind regards,
    Pana
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. Ioan
    Ioan avatar
    2 posts
    Member since:
    Jun 2011

    Posted 24 May 2012 Link to this post

    Hi, 
    I'm in .NET 4.0 and because now ressources are freezed, I get this exception "This Freezable cannot be frozen". What I want to do is use a static brush declared like this:

    <SolidColorBrush x:Key="BasicBrush" telerik:MetroColors.Color="Basic" />
    
    in an animation.
    
    Apparently .NET calls the Freeze() method without checking first that the brush has already been freezed.
    
    Update: 
    
    This did not happen in a previous version. The current version that generates this exception is 
    'RadControls for WPF Q1 2012 SP1'.
    
    
    
    
  4. Ioan
    Ioan avatar
    2 posts
    Member since:
    Jun 2011

    Posted 24 May 2012 Link to this post

    Just wanted to let you know I found a possible solution to my problem (the freezable exception) by declaring brushes a little bit differently (I inspired myself from this telerik page):
    <SolidColorBrush x:Key="BasicBrush" Color="{Binding Source={StaticResource MetroColors}, Path=Palette.BasicColor}" />
    
Back to Top