c# - How to use IValueConverter implementation from another file? -
i have ivalueconverter implementation - iconextractor. use way:
<image source="{binding converter={staticresource iconextractor}, converterparameter=c:\\windows\\system32\\shell32.dll|72}"/> but work, iconextractor must reside in code-behind-file of xaml, e.g: main window mainwindow.xaml, class iconextractor must in mainwindow.xaml.cs. cannot place elsewhere ?
your ivalueconverter class can anywhere want, including in assembly. based on use, need have resource somewhere accessible mainwindow class. easy way have in window resources.
<mainwindow.resources> <my:iconextractor x:key="iconextractor"/> </mainwindow.resources> you can use resources in app.xaml, since resources accessible xaml based classes in project. using app.xaml appeals me since can avoid duplicating effort if more 1 window in project use iconextractor.
Comments
Post a Comment