{0} is not valid for Setter.Value. The only suppor

2020-03-03 08:17发布

问题:

iv'e got a XAML issue , in a project where working on vs2010 we use our own CustomBinding when using DynamicResource in my XAML the Designer throughs me the following expception :

CustomBinding is not valid for Setter.Value. 
The only supported MarkupExtension types are  
DynamicResourceExtension and BindingBase or derived types.    

even though it's not in use in that particular Extention..

<SomeControl Value="{CustomBinding SomeValue} 
             Style="{DynamicResource SomeStyle}" />

Style="{DynamicResource SomeStyle}" is the part which throws the design time exception and the style is never set as a result .

if any one came across a similar issue , please advise . thanks.

回答1:

Setter.Value used in your Style only support some hardcoded classes (StaticResource, DynamicResource and BindingBase) because providing of a value has to be deferred to the point when Styles are applied and it seems they had not enough time to implement it properly so they check for the supported classes and apply them later.