Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - "The Freezable can not be frozen.." with {DynamicResource {x:Static SystemColors.ControlDarkDarkColorKey}}

 
 
Old 01-31-2006   #1 (permalink)
Keith Patrick


 
 

"The Freezable can not be frozen.." with {DynamicResource {x:Static SystemColors.ControlDarkDarkColorKey}}

Any time I have {DynamicResource {x:Static
SystemColors.ControlDarkDarkColorKey}} (or any of the systemcolors keys) in
my Resource.xaml file for an app, I get an exception during initialization
that "The Freezable can not be frozen.." I figure it has something to do
with back patching not being in WPF any more, but I'm confused a bit in that
SystemColors.ControlDarDarkColorKey already exists at initialization so back
patching should not be necessary. Does anyone have an idea if I'm doing
something wrong or hitting a bug (this is the January CTP)?



My System SpecsSystem Spec
Old 01-31-2006   #2 (permalink)
Adam Smith [MS]


 
 

Re: "The Freezable can not be frozen.." with {DynamicResource {x:Static SystemColors.ControlDarkDarkColorKey}}

I'm not sure what is meant by "back patching", so I don't know if that
applies to this situation. What I can say is that this exception is thrown
when code attempts to Freeze a Freezable which cannot be frozen (I know,
that much was in the exception text). Most of the time, this occurs because
the Freezable in question has a property set to a dynamic resource reference
or a databinding, or because (in code) there's an animation present
(Storyboards do not (in general) present this problem). In this case, I
imagine you have a SolidColorBrush in your ResourceDictionary, and this
SolidColorBrush's Color property is set to a dynamic resource reference.
Resources are frozen upon creation, but this particular instance cannot be
frozen.

On Monday I'll check in with the resources team to see if this
(auto-freezing of resources) is by design. In the mean time, consider
changing the reference to a static reference - it will update once (upon
parse, I believe), and then be able to be frozen. All you lose is dynamic
changes in the event the ControlDarkColor changes at run time, and I'm not
sure if WPF propagates that change in any case.

Hope this helps,
-Adam Smith [MS]

"Keith Patrick" <richard_keith_patrick@nospam.hotmail.com> wrote in message
news:O7YKAf3IGHA.3224@TK2MSFTNGP09.phx.gbl...
> Any time I have {DynamicResource {x:Static
> SystemColors.ControlDarkDarkColorKey}} (or any of the systemcolors keys)
> in my Resource.xaml file for an app, I get an exception during
> initialization that "The Freezable can not be frozen.." I figure it has
> something to do with back patching not being in WPF any more, but I'm
> confused a bit in that SystemColors.ControlDarDarkColorKey already exists
> at initialization so back patching should not be necessary. Does anyone
> have an idea if I'm doing something wrong or hitting a bug (this is the
> January CTP)?
>



My System SpecsSystem Spec
Old 02-02-2006   #3 (permalink)
Nick Kramer [MSFT]


 
 

Re: "The Freezable can not be frozen.." with {DynamicResource {x:Static SystemColors.ControlDarkDarkColorKey}}

WPF will freeze any freezables inside a style or template. Styles and
templates can be used on multiple threads, and freezables can't unless
they're frozen. We're currently considering extending this to anything put
inside Application.Resources, since that has the same threading problem...

As Adam said, DynamicResource on a frozen freezable doesn't work, because a
frozen freezable potentially has multiple parents -- so it's ambiguous which
parent we would search for the resource.

-Nick Kramer [MSFT]
http://blogs.msdn.com/nickkramer

---
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Adam Smith [MS]" <Adam.Smith@microsoft.com> wrote in message
news:uLnvkM%23IGHA.1088@tk2msftngp13.phx.gbl...
> I'm not sure what is meant by "back patching", so I don't know if that
> applies to this situation. What I can say is that this exception is
> thrown when code attempts to Freeze a Freezable which cannot be frozen (I
> know, that much was in the exception text). Most of the time, this occurs
> because the Freezable in question has a property set to a dynamic resource
> reference or a databinding, or because (in code) there's an animation
> present (Storyboards do not (in general) present this problem). In this
> case, I imagine you have a SolidColorBrush in your ResourceDictionary, and
> this SolidColorBrush's Color property is set to a dynamic resource
> reference. Resources are frozen upon creation, but this particular
> instance cannot be frozen.
>
> On Monday I'll check in with the resources team to see if this
> (auto-freezing of resources) is by design. In the mean time, consider
> changing the reference to a static reference - it will update once (upon
> parse, I believe), and then be able to be frozen. All you lose is dynamic
> changes in the event the ControlDarkColor changes at run time, and I'm not
> sure if WPF propagates that change in any case.
>
> Hope this helps,
> -Adam Smith [MS]
>
> "Keith Patrick" <richard_keith_patrick@nospam.hotmail.com> wrote in
> message news:O7YKAf3IGHA.3224@TK2MSFTNGP09.phx.gbl...
>> Any time I have {DynamicResource {x:Static
>> SystemColors.ControlDarkDarkColorKey}} (or any of the systemcolors keys)
>> in my Resource.xaml file for an app, I get an exception during
>> initialization that "The Freezable can not be frozen.." I figure it has
>> something to do with back patching not being in WPF any more, but I'm
>> confused a bit in that SystemColors.ControlDarDarkColorKey already exists
>> at initialization so back patching should not be necessary. Does anyone
>> have an idea if I'm doing something wrong or hitting a bug (this is the
>> January CTP)?
>>

>
>



My System SpecsSystem Spec
Old 02-05-2006   #4 (permalink)
Adahn


 
 

Re: "The Freezable can not be frozen.." with {DynamicResource {x:Static SystemColors.ControlDarkDarkColorKey}}

LOL at the error message ^_^

...sorry

"Keith Patrick" <richard_keith_patrick@nospam.hotmail.com> wrote in message
news:O7YKAf3IGHA.3224@TK2MSFTNGP09.phx.gbl...
> Any time I have {DynamicResource {x:Static
> SystemColors.ControlDarkDarkColorKey}} (or any of the systemcolors keys)
> in my Resource.xaml file for an app, I get an exception during
> initialization that "The Freezable can not be frozen.."


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Unwanted Multiple contacts in "To","CC","BCC" of email send catago Vista mail
Vista not wotking with "My Computer" or "Control Panel", "Screen Saver" Vista General
Windows Mail is in "frozen" stage Vista mail
WM5 Sync with Vista "Windows Calender", "Contacts", and "Mail" Vista General
Frozen at "Installing features" Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46