Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Button with Image not showing in XAML

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-13-2006   #1 (permalink)
Atul Bahl
Guest


 

Button with Image not showing in XAML

I am not pretty much new to XAML and I am trying to create a solution which
has buttons with image as background and I am using the following syntax,
and it is not showing up. Also if feasible can somebody guide me how I can
reference these directly from resource file.

<Button>
<Image Source="Resources\Images\Select.png"></Image>

</Button>



Thanks

Atul



My System SpecsSystem Spec
Old 07-16-2006   #2 (permalink)
=?Utf-8?B?V29sZmdhbmdC?=
Guest


 

RE: Button with Image not showing in XAML

In WPF, images must be embedded as Resource - type items. This is different
from the WinForms way to use the Resources.resx.
I usually create a folder, say 'Images' in my project - this creates a file
folder with the same name on disk, then copy the image(s) into this folder
(using windows explorer). Then, go back to Visual Studio. In the project
view, right-click on the 'Images' folder and choose 'Add Existing Item' to
add the image as a resource (shows as Build Action : Resource in the
properties window).
Then simply use e.g. Image Source="Images/mypicture.jpg" im XAML and it
should work.


"Atul Bahl" wrote:

> I am not pretty much new to XAML and I am trying to create a solution which
> has buttons with image as background and I am using the following syntax,
> and it is not showing up. Also if feasible can somebody guide me how I can
> reference these directly from resource file.
>
> <Button>
> <Image Source="Resources\Images\Select.png"></Image>
>
> </Button>
>
>
>
> Thanks
>
> Atul
>
>
>

My System SpecsSystem Spec
Old 07-17-2006   #3 (permalink)
Atul Bahl
Guest


 

Re: Button with Image not showing in XAML

Thanks for replying as I was thinking nobody looks at this news group.



Anyway I followed your recommended approach and it still does not work. I am
working again June CTP version of windows SDK. Also I have noticed none of
the samples included with the Windows SDK using WPF is able to display
images.



Not sure whether that is a bug in June CTP or what. Would definitely
appreciate any guidance.



"WolfgangB" <WolfgangB@discussions.microsoft.com> wrote in message
news:C4361D68-3B95-4F38-BEF2-1B28F9FBAAFE@microsoft.com...
> In WPF, images must be embedded as Resource - type items. This is
> different
> from the WinForms way to use the Resources.resx.
> I usually create a folder, say 'Images' in my project - this creates a
> file
> folder with the same name on disk, then copy the image(s) into this folder
> (using windows explorer). Then, go back to Visual Studio. In the project
> view, right-click on the 'Images' folder and choose 'Add Existing Item' to
> add the image as a resource (shows as Build Action : Resource in the
> properties window).
> Then simply use e.g. Image Source="Images/mypicture.jpg" im XAML and it
> should work.
>
>
> "Atul Bahl" wrote:
>
>> I am not pretty much new to XAML and I am trying to create a solution
>> which
>> has buttons with image as background and I am using the following syntax,
>> and it is not showing up. Also if feasible can somebody guide me how I
>> can
>> reference these directly from resource file.
>>
>> <Button>
>> <Image Source="Resources\Images\Select.png"></Image>
>>
>> </Button>
>>
>>
>>
>> Thanks
>>
>> Atul
>>
>>
>>



My System SpecsSystem Spec
Old 07-26-2006   #4 (permalink)
=?Utf-8?B?Q3RB?=
Guest


 

Re: Button with Image not showing in XAML

Hi,
I think problem could be related to WIC version, to fix :
http://msdn.microsoft.com/windowsvis...lt.aspx#topic2

I'm going to try as per link;
Good luck.

"Atul Bahl" wrote:

> Thanks for replying as I was thinking nobody looks at this news group.
>
>
>
> Anyway I followed your recommended approach and it still does not work. I am
> working again June CTP version of windows SDK. Also I have noticed none of
> the samples included with the Windows SDK using WPF is able to display
> images.
>
>
>
> Not sure whether that is a bug in June CTP or what. Would definitely
> appreciate any guidance.
>
>
>
> "WolfgangB" <WolfgangB@discussions.microsoft.com> wrote in message
> news:C4361D68-3B95-4F38-BEF2-1B28F9FBAAFE@microsoft.com...
> > In WPF, images must be embedded as Resource - type items. This is
> > different
> > from the WinForms way to use the Resources.resx.
> > I usually create a folder, say 'Images' in my project - this creates a
> > file
> > folder with the same name on disk, then copy the image(s) into this folder
> > (using windows explorer). Then, go back to Visual Studio. In the project
> > view, right-click on the 'Images' folder and choose 'Add Existing Item' to
> > add the image as a resource (shows as Build Action : Resource in the
> > properties window).
> > Then simply use e.g. Image Source="Images/mypicture.jpg" im XAML and it
> > should work.
> >
> >
> > "Atul Bahl" wrote:
> >
> >> I am not pretty much new to XAML and I am trying to create a solution
> >> which
> >> has buttons with image as background and I am using the following syntax,
> >> and it is not showing up. Also if feasible can somebody guide me how I
> >> can
> >> reference these directly from resource file.
> >>
> >> <Button>
> >> <Image Source="Resources\Images\Select.png"></Image>
> >>
> >> </Button>
> >>
> >>
> >>
> >> Thanks
> >>
> >> Atul
> >>
> >>
> >>

>
>
>

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to include XAML files into another XAML file? star-italia .NET General 6 06-12-2008 04:56 AM
Signature Image not showing in some replys...? DaisyP Vista mail 0 03-20-2008 04:36 PM
Data binding of Button.Content to an image in a XML island does not work muchinger@web.de Avalon 1 04-17-2007 11:06 AM
Button with regular image and disabled image loumfranco@gmail.com Avalon 1 05-31-2006 02:47 PM
How to make UI controls like button,TextBox 3d using XAML. Enigmatic Avalon 0 02-24-2006 04:11 PM


Vistax64.com 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 2005-2008

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 47 48 49 50 51