c# - StaticResource is null even though it's defined in XAML? -


i've got bit of niche scenario i'm not expecting solve, thought i'd give shot:

i have windows forms user control, contains single elementhostcontrol has it's child property set wpf / xaml user control.

i'm getting strange behaviour whereby xaml contains looks this:

<usercontrol>   <usercontrol.resources>     <somenamespace:myresource x:key="foo" />   </usercontrol.resources>   <grid datacontext="{staticresource foo}">    ...   </grid> </usercontrol> 

i xamlparseexception @ runtime, asking me provide value, though it's defined above.

i can see initializecomponent() being called, that's far can step.

in code behind, in wpf / xaml user control, if before initializecomponent() called add: this.resources["foo"] = new myresource() works great again.

just confuse matters further, happens when use visual studio 2015 compile code - compiling using vs2013 (on same machine/no solution changes whatsoever) works perfectly.

has got ideas, or helps on how debug this?


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -