c# - Bind Window Icon to Image Control -


currently have problems bindings in wpf. project divided 2 projects: 1. library 2. demo project including library.

my demo project has main window icon. in viewmodel of window open window located in library. set icon of window in library icon of main window demo project.

the window of library has image control , bound icon of window:

<image width="32" height="32" source="{binding elementname=windowpackageinformation, path=icon}" /> 

window's icon defined follows:

name="windowpackageinformation" icon="/ypus_lib;component/icon_32x32.ico" 

in designer view image showing when starting application fails exception saying icon unable locate.

does have idea?

your icon (.ico) file should added project planning use it. build action should set resource.

try accessing pack://application:,,,/referencedassembly;component/possiblesubfolder/yo‌​urresourcefile.ico


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -