Button image not visible - image

I'm trying to create a Windows 8.1 store app, and I need to add a button to it.
The button should display an image.
I add the image to the assembly in Solution Exploreras Artwork/Pencil.png
I add the button to the UI
Using the property editor for the button, I select Foreground image.
The designer shows a list of available images from the assembly, I choose the image.
The designer shows the selected image (partially).
The button remains blank.
I tryied playing around with different content types (of the image), as Content, Embedded resource, Do not copy, Copy if newer.
The image is not visible either at design or run time.
I found tons of articles from 2005 to 2012 about this problem in WPF. Tryed to change the image source (although I think the designer should set it correctly):
Pencil.png
Artwork/Pencil.png
pack://siteoforigin:,,,/Pencil.png
pack://siteoforigin:,,,/Artwork/Pencil.png
pack://application:,,,/Pencil.png
pack://application:,,,/Artwork/Pencil.png
Any ideas?
To make the environment clear:
Visual Studio 2013 Update 2
Project type: Visual C#/Store Apps/Windows Apps/Blank App
Target: Windows 8.1

It seems that the correct combination (to display an image on a Windows 8 app button) is:
set it as backbround image (as opposed to foreground)
set the file to be "PRIResource" (as opposed to "Embedded resource")
use the designer to specify the image (which will generate a reference like this "Artwork/Pencil.png")
:-(
It works design-time, but it does not work runtime.

Here's one that works both design-time and runtime:
set it as backbround image (as opposed to foreground)
set the file to be "Content", "Copy if newer"
use the designer to specify the image (which will generate a reference like this "Artwork/Pencil.png")

Related

Windows Phone 7 Development - Image Source Issue

While developing a project for Windows Phone 7, I'm adding an image control onto the Grid and using the following code in C# to set the image source:-
Uri nUri = new Uri("/TestImage.png", UriKind.Relative);
BitmapImage nBitmapImage = new BitmapImage(nUri);
FacebookImage.Source = nBitmapImage;
The problem is that whenever I use custom images, they do not show up when I build and run the app on the emulator. Whereas, if I change the image file name in the above code to one of the images that are included in the project by default (ApplicationIcon.png), the image shows up upon running. I would like to know if this is a problem with the code or with the custom image files I'm using. I'm ensuring that the images I'm creating are proper and have the same attributes as the images included by default.
Could someone please help me out with this.
Thanks.
Click on your custom picture in Visual Studio's Solution Explorer. Then, look at the property window (press F4 if it's closed), and at the "Build Action" line. It basically tells the compiler how to embed your file in the application. The build action of ApplicationIcon.png should be "Content", just set the same one for your custom pictures.

How to get an Innosetup installer package to display a non-scaled icon image (>32x32)

I've started using 'large' icons on my desktop. For a while I've also been including images > 32x32 in my Delphi Application. The result is a nice clean image display in all Windows display situtations. I know its rather picky, but i've just noticed that a compiled Innosetup package displays fuzzy - I presume its being scaled - and it occured to me that there must be a way of adding to or changing the default Innosetup image displayed for its EXE. You can see the effect in the image below. I have many icons available to me, so a solution for replacing the default icon would be great.
Ah I found it. To specify a custom icon for a setup application, use the SetupIconFile directive:
[Setup]
SetupIconFile="MyIcon.ico"

Use ApplicationBar Icons from other assemblies?

I have a Page in a Windows Phone class library. This page has an appbar. I would prefer everything this page needs to be included within the class library so the setup list for consumers of this page / assembly is minimal.
However, When I set ApplicationBar icons, they get added to the class library project under the folder 'icons' just like normal, they show up fine in Blend, but at runtime they are no where to be found!
When I put the icons in the Windows Phone Application project all is well. However this is not my desired scenario as it is additional configuration / setup by the application author to use my pages.
I tried using the resource pathing using /{AssemblyName};component/icons/{IconName} but of course the AppBar needs them to be of type "Content" not "Resource". So I am thinking this is impossible but I wanted to know if anybody out there figured out how to do this.
Sorry guys. I just figured it out. I changed the newly added icons from "Resource" to "Content" but I forgot to set "Copy if newer" so they weren't getting outputted to the Bin\Debug\icons folder of the windows Phone Application. something to keep an eye on I guess.

Phonegap on WP7 does not load images

I'm starting my first PhoneGap project and am developing using Visual Studio and Windows Phone 7, although I intend on ultimately deploying to iOS and Symbian as well.
However, I'm stuck at Step 1. I have added an image to the www/images folder, and put the following code:
<img src="images/login-btn.png" width="103" height="42" style="margin-left:90px;" />
And I get:
It works fine when I preview it in IE9, but I don't have a Mac to test it on iOS yet.
It's worth noting that the JS files and CSS have loaded fine, it's just any image (whether referenced in CSS or an <img> tag) always comes up broken.
My guess would be the Build Action of your image file is incorrect.
According to http://wiki.phonegap.com/w/page/48672055/Getting%20Started%20with%20PhoneGap%20Windows%20Phone%207#4Reviewtheprojectstructure section 4. You should be setting the Build Action of your images etc to Content which simply copies them into the output project when it is built. They are probably currently set to Resource or None.
To change the Build Action right click a file and choose properties to go to the properties window if you do not already have it open. It is probably then the first property. Just click and choose the correct one.
I'm posting this to questions that I found while trying to find my answer to the same problem. The JS framework I use adds a url query to each image when in a debugging mode (in order to force browsers to reload image, instead of using cached). So, my image "image/background.jpg" would be accessed as "image/background.jpg?d=34342233". But, when running on PhoneGAP for Windows Phone, it won't recognize the image, and thus it shows up as broken. So, I had to turn off debugging for the framework I use, and suddenly the images showed up (still, don't forget to set the Build Action to "Content" as mentioned earlier).

Stanford's initial assignment not working

Stanford put out for free a series of videos and handouts for their iPhone programming course. I've played around with the first assignment, but all I get on the Simulator is a blank screen. Here's the recipe I followed; what am I missing?
In Xcode, create a new Window-Based iPhone application.
Open the project’s MainWindow.xib file with Interface Builder.
Add the following user interface elements to the view:
a text label
an image view
Set the following properties on the text label:
text value should be “Hello Stanford!” (or something suitably amusing)
text alignment should be centered
adjust the size to make the text large
Back in Xcode, add an image (.png or .jpg) to your project. You can use the Project > Add to Project... menu to select an image. Note: Be sure to check the “Copy items into desti- nation group’s folder (if needed)” checkbox.
Once your image is in the project, return to MainWindow.xib, select the image view and set the image for the image view that you dragged in previously using the Attributes Inspector.
Configure the image view’s “Mode” to be “Aspect Fit”
In Xcode, build and run your project in the simulator.
Been there, done that, but no t-shirt. Seems to me I'm missing connecting lines in the Interface Builder, but I see nothing in the recipe about that.
Since you didn't provide a link, I'll assume you're talking about this document.
Works for me on XCode 3.2.3/Snow Leopard 10.6.4. I created the project as iPhone-only, as opposed to Universal, but it shouldn't make a difference for your purposes.
Try again from scratch, or take a look at my project here.

Resources