wpf - System.Windows.Media.SolidColorBrush Must Have IsFrozen set to False to edit error -


i have wpf application in i've modified templates number of controls. under number of different circumstances, following stack trace:

specified value of type 'system.windows.media.solidcolorbrush' must have isfrozen set false modify. specified value of type 'system.windows.media.solidcolorbrush' must have isfrozen set false modify. (exception class invalidoperationexception)     @ system.windows.markup.xamlreader.rewrapexception(exception e, uri baseuri)    @ system.windows.frameworktemplate.loadtemplatexaml(xamlreader templatereader, xamlobjectwriter currentwriter)    @ system.windows.frameworktemplate.loadtemplatexaml(xamlobjectwriter objectwriter)    @ system.windows.frameworktemplate.loadoptimizedtemplatecontent(dependencyobject container, icomponentconnector componentconnector, istyleconnector styleconnector, list`1 affectedchildren, uncommonfield`1 templatednonfechildrenfield)    @ system.windows.frameworktemplate.loadcontent(dependencyobject container, list`1 affectedchildren)    @ system.windows.stylehelper.applytemplatecontent(uncommonfield`1 datafield, dependencyobject container, frameworkelementfactory templateroot, int32 lastchildindex, hybriddictionary childindexfromchildid, frameworktemplate frameworktemplate)    @ system.windows.frameworktemplate.applytemplatecontent(uncommonfield`1 templatedatafield, frameworkelement container)    @ system.windows.frameworkelement.applytemplate()    @ system.windows.frameworkelement.measurecore(size availablesize)    @ system.windows.uielement.measure(size availablesize)    @ system.windows.controls.border.measureoverride(size constraint)    @ system.windows.frameworkelement.measurecore(size availablesize)    @ system.windows.uielement.measure(size availablesize)    @ system.windows.controls.grid.measurecell(int32 cell, boolean forceinfinityv)    @ system.windows.controls.grid.measurecellsgroup(int32 cellshead, size referencesize, boolean ignoredesiredsizeu, boolean forceinfinityv)    @ system.windows.controls.grid.measureoverride(size constraint)    @ system.windows.frameworkelement.measurecore(size availablesize)    @ system.windows.uielement.measure(size availablesize)    @ system.windows.controls.control.measureoverride(size constraint)    @ system.windows.frameworkelement.measurecore(size availablesize)    @ system.windows.uielement.measure(size availablesize)    @ system.windows.controls.grid.measurecell(int32 cell, boolean forceinfinityv)    @ system.windows.controls.grid.measurecellsgroup(int32 cellshead, size referencesize, boolean ignoredesiredsizeu, boolean forceinfinityv)    @ system.windows.controls.grid.measureoverride(size constraint)    @ system.windows.frameworkelement.measurecore(size availablesize)    @ system.windows.uielement.measure(size availablesize)    @ ms.internal.helper.measureelementwithsinglechild(uielement element, size constraint)    @ system.windows.controls.contentpresenter.measureoverride(size constraint)    @ system.windows.frameworkelement.measurecore(size availablesize)    @ system.windows.uielement.measure(size availablesize)    @ system.windows.contextlayoutmanager.updatelayout()    @ system.windows.contextlayoutmanager.updatelayoutcallback(object arg)    @ system.windows.media.mediacontext.invokeonrendercallback.dowork()    @ system.windows.media.mediacontext.fireinvokeonrendercallbacks()    @ system.windows.media.mediacontext.rendermessagehandlercore(object resizedcompositiontarget)    @ system.windows.media.mediacontext.rendermessagehandler(object resizedcompositiontarget)    @ system.windows.media.mediacontext.resize(icompositiontarget resizedcompositiontarget)    @ system.windows.interop.hwndtarget.onresize()    @ system.windows.interop.hwndtarget.handlemessage(windowmessage msg, intptr wparam, intptr lparam)    @ system.windows.interop.hwndsource.hwndtargetfiltermessage(intptr hwnd, int32 msg, intptr wparam, intptr lparam, boolean& handled)    @ ms.win32.hwndwrapper.wndproc(intptr hwnd, int32 msg, intptr wparam, intptr lparam, boolean& handled)    @ ms.win32.hwndsubclass.dispatchercallbackoperation(object o)    @ system.windows.threading.exceptionwrapper.internalrealcall(delegate callback, object args, int32 numargs)    @ ms.internal.threading.exceptionfilterhelper.trycatchwhen(object source, delegate method, object args, int32 numargs, delegate catchhandler) 

i haven't written code tries change vales of brushes. , have no idea control generating error. suspect problem in 1 of templates modified, don't know one.

i haven't clue how track down , debug it. have thoughts?

i got lucky on one.

i noticed error occurs on 2 different screens in application. control have in common radgridview control telerik. had done custom modifications control support changing color pallet "day mode" "night mode".

i don't know did wong, removed custom template app.xaml file , error went away. regenerated template in expression blend, replacing setters color changes made. , error still gone!

i suspect may have upgraded telerik library in middle of implementing "night mode" , had obsolete template control. in event, error gone, @ least now.


Comments