wpf - Can't properly load a ResourceDictionary at runtime -
note: have resourcedictionary , wpf window (my view) , viewmodel, declared within winforms application. therefore have no app.xaml.
i have following converter declared:
public class debugconverter implements ivalueconverter public function convert(byval value object, byval targettype system.type, byval parameter object, byval culture system.globalization.cultureinfo) object implements system.windows.data.ivalueconverter.convert return value end function public function convertback(byval value object, byval targettype system.type, byval parameter object, byval culture system.globalization.cultureinfo) object implements system.windows.data.ivalueconverter.convertback return value end function end class
and try loading resourcedictionary @ runtime (which specified build action resource , not page):
m_rdgriddictionary = new resourcedictionary() m_rdgriddictionary.source = new uri("pack://application:,,,/wpf/helpers/gridresourcedictionary.xaml")
in resourcedictionary have declared such:
<resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cnv="clr-namespace:positron.cad.windowgui.wpfconverters"> <cnv:debugconverter x:key="debugconverter"/> </resourcedictionary>
but when try loading resourcedictionary, cannot find converter:
would know wrong scenario? both exist in same namespaces, shouldn't problem.
solved! build action had page , not resource.
Comments
Post a Comment