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 with Image not showing in XAML

 
 
Old 07-13-2006   #1 (permalink)
Atul Bahl


 
 

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?=


 
 

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


 
 

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?=


 
 

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
 

Thread Tools


Similar Threads
Thread Forum
Datagrid Image Button Select Column .NET General
Background Image for each folder type not showing. General Discussion
Signature Image not showing in some replys...? Vista mail


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