질문하기질문하기
 

답변됨Can we embed in Expression Blend ???

  • 2009년 7월 3일 금요일 오후 9:00assassin316 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    When working in VS 2008, one of the features I really liked was the ability to select a button, or label, etc... and then be able to chose an icon or image which would be EMBEDDED into the .resx file of the related form.

    Is this functionality still available with Blend and WPF ??  I've noticed that whenever I work with images in Blend, it simply copies the file to the local directory, it doesn't embed them like VS 2008 does.

    Thanks !

답변

  • 2009년 7월 3일 금요일 오후 9:49JamesChambers 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Hey assassin,

    How are you getting your images in?

    What you are doing in WPF is not unlike the WinForms world.  What you want to do (if you are working in VS.Net is to add the image, ensure the build type is set to resource and copy local is false.  At that point you can use the designer and property windows to draw image controls and set the Uri to the image.

    If you're using Blend, it does most of the gritty for you (and a bit more).  I have the latest version of Blend 2 running with 3.5 SP1 and I typically do the following:
    1) Using the project tab, add an Images folder (this is just my convention)
    2) Right-click on the file and say 'add existing file'

    At this point, if you were double-click on image in the project folder (with a window designer open) it would place the image on the window. If you inspect the project file, it is added as a resource (not as content) to the project.  If you build and run the app, the image is not copied to the output directory.

    If you're working with existing projects that already have resources, say, a cross-over project from VS.Net, you can write out the Uri yourself with the pack syntax.  There are great posts on that out there such as here and here.

    Hope this helps some, and let me know what version of Blend you have and how you're adding images.

    Cheers,
    -jc

    Me, coding and stuff: Mr. James

모든 응답

  • 2009년 7월 3일 금요일 오후 9:39Guenter Schwaiger 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hi assassin316,

    Blend coppies the file and mark it with the build action "Resource". This embeds the resource to your assembly.

    Hope this helps.
  • 2009년 7월 3일 금요일 오후 9:49JamesChambers 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Hey assassin,

    How are you getting your images in?

    What you are doing in WPF is not unlike the WinForms world.  What you want to do (if you are working in VS.Net is to add the image, ensure the build type is set to resource and copy local is false.  At that point you can use the designer and property windows to draw image controls and set the Uri to the image.

    If you're using Blend, it does most of the gritty for you (and a bit more).  I have the latest version of Blend 2 running with 3.5 SP1 and I typically do the following:
    1) Using the project tab, add an Images folder (this is just my convention)
    2) Right-click on the file and say 'add existing file'

    At this point, if you were double-click on image in the project folder (with a window designer open) it would place the image on the window. If you inspect the project file, it is added as a resource (not as content) to the project.  If you build and run the app, the image is not copied to the output directory.

    If you're working with existing projects that already have resources, say, a cross-over project from VS.Net, you can write out the Uri yourself with the pack syntax.  There are great posts on that out there such as here and here.

    Hope this helps some, and let me know what version of Blend you have and how you're adding images.

    Cheers,
    -jc

    Me, coding and stuff: Mr. James
  • 2009년 7월 4일 토요일 오전 3:53assassin316 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    Wow, thanks to the both of you, I had no idea that it was in fact being added as a resource. I guess the fact that it copied the file made me think otherwise.

    In answer to jc, I'm also using Blend 2. I hope WPF takes off like Winforms did because I see a lot of potential with it (that's of course if they can fix the performance issues).

    Thanks again !