Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - button images from resources

 
 
Old 05-10-2006   #1 (permalink)
cata


 
 

button images from resources

Hi all!

I am using VS2005 and I am struggling with a simple problem for which I
couldn't find a simple solution. Maybe because my background is
hardcore Java .

So, I included an image in my resources and I want to use it form XAML.
The code I saw so far says to put something like:

<Image Source="..\Resources\image.gif" ...

which is in my opinion ... strange because I saw that each image added
to the resources generates code like this:

quote form Resources.resx xaml
.....
<data name="image" type="System.Resources.ResXFileRef,
System.Windows.Forms">
<value>..\Resources\image.gif;System.Drawing.Bitmap,
System.Drawing, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
......

and

qoute from Resource.Designer.cs
.....
internal static System.Drawing.Bitmap image{
get {
object obj = ResourceManager.GetObject("image",
resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
.....

So, I "feel" that VS generates some items for me to use but I couldn't
figure out how to do it from XAML. I agree that VS created the
Resources directory into my project although the initial image was in a
different directory - and this might help - but still, I find this ...
strange.

The only way I found to use the "image" was programmatically in c#
using ResourceManager and a Bitmap to BitmapImage converter which
somehow duplicates the code generated automatically by VS.

I repeat, I'd like to use the image from resources in XAML only.

Is

<Image Source="..\Resource\image.gif" ...

the only way?

Thank you,

Catalin


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Button Cotrol: Event, when mouse leaves button with mousebutten still down .NET General
Vista SP2: Stop button disabled when Send/Recv button pressed Vista mail
Re: Attachment Save Button Greyed out for images Vista mail
Button images missing in Windows Help system Vista General
disable lock button beside power button? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46