Can not access the staticresource from a ResourceDictionary

106 views Asked by At

AB.xaml MergedDictionaries A.xaml and B.xaml
CD.xaml MergedDictionaries C.xaml and D.xaml
BaseStyle.xaml MergedDictionaries AB.xaml and CD.xaml
app.xaml MergedDictionaries BaseStyle.xaml

suppose that i have a brush defined in A.xaml, and in C.xaml use the brush.

application has merged the AB.xaml first,and then CD.xaml, but the question is that why C.xmal can not access the brush resource when runing the application using StaticResource keyword.

Of course, DynamicResource keyword work fine.
And if app.xaml directly Merged AB.xaml and CD.xaml, also work fine. so what is the different?

1

There are 1 answers

0
Transfen On

finally i find the reason:
Visit https://stackoverflow.com/a/2679228/2325995

MSDN: Resources in a merged dictionary occupy a location in the resource lookup scope that is just after the scope of the main resource dictionary they are merged into.