This is a nubie question, I have a silverlight 5 (VB) application that runs fine and displays all 3 png images when I run it from my PC. When the app is put onto the web it doesn't show the png Images. The build I have selected for the png files is Resource? I checked the XAP.zip to see if the png files are there and they are.
I've done a bit of research and found that I may need some coding to enable me to get these up and running on the web unfortunately everything I've looked at is in C. I have found these two pieces of code :
<Imagex:Name="myIamge"Source="../computer.JPG"></Image>
myIamge.Source = new BitmapImage(new Uri("../Image/computer.JPG", UriKind.Relative));
Are these two pieces of code what I need?
Do I need them both together?
Does anyone know the conversion Of the second piece of code from c to vb
Is there anyone out there that can tell me how to do this in silverlight VB
Regards
Will
Are these two pieces of code what I need?
Probably, hard to say because you did not explain us where you put physically your 'computer.JPG'
Do I need them both together?
No, if you display this image only once, and never change it after, you do no need the code behind. Just use your xaml declaration.
So, what you have done seems pretty correct: your image should be declared as ressource, and you use the path to specify where the image is, compare to the XAML file using your image.
Thus, for instance if the declaration is in the MainPage.xaml (to the root of your project), and your image in an Image folder, this declaration is correct.
<Image x:Name="myImage" Source="Image/computer.jpg"/>
If despite this, you cannot see your image, I will recommand you to check the website where you deploy your xap file, maybe there is an error explaining why the image can not show up (MIME type, .net version?...)
Related
In short I want to pass variables to a vsto project from my windows form project and I don't know how.
I currently have a windows forms project that is near completion with one major piece missing. I have been searching for about two work days for a way to open a VTSO word project in the same solution with a procedure in my windows form project. I know I can code my project to open the word document and my code for default values for the content controls in the "ThisDocument.vb" display correctly. I have added references to my VTSO project to refer to my forms project in an attempt to use variables previously collected to fill in my content controls text, but I have no clue how to do this. Will I have to open the word document and use interops to modify the document separately? I would prefer my answer in VB.Net but if C# is what ya know, I'll take anything to help.
I have a Silverlight 3 App that became quite big over the time. So I began to try to break it in several smaler Applications that will be dynamically loaded in my Main Application on demand. But I run into a strange problems with my VS 2008.
When I add a new Silverlight Application project to my solution and copy User Controls from my old Main Application into this new project it happens from time to time (about twice a day) that the XAML files and their code behind files loose their association. When this happens and I try to build the project, the compiler complains that he cannot find all the Ccontrols like buttons, labels etc. in the code behind files that I added to the class in the XAML-file. And the build fails of course.
The only workaround that I found so far is to add another Silverlight Application project and move all the content from the first added project to it. Than everything works fine for a while until the problem occurs again.
But that's not really a solution.
Any Ideas what happens here and what i can do?
Best Regards,
Rocko
I have seen issues like this before when changing the namespaces on controls in silverlight. The issue crops up when you don't change both the namespace on the control class, and the full name of the class in the x:class attribute on the root element of the control.
Not sure if this fits your situation or not, but it's the only time I've run into similar issues.
I need to display an image, which I've done without problems before, but today I decided to be tricky and use "add as link" instead. Well, now I get:
The file Images/hello.png is not part of the project or its 'Build Action' property is not set to 'Resource'.
Wait... its Build Action is set to Resource. I've seen a Silverlight solution that involves the usage of Merged Dictionaries to share files between Silverlight and WPF projects, but it's not clear to me that this would even apply to my WPF + Image issue.
Has anyone solved this problem before? I could make copies of all of the images, but that seems a little silly if I have a shared repository with clip art and the like.
Dave,
I've just tried to add image as a link to plain WPF application. Build action is "Resource" (don't confuse with "Embedded Resource"). I've added it to the root, and refer to it as <Image Source="/file_name.jpg"/> - all works fine.
The message you have is it compile or runtime? If it's a runtime, how do you refer to the image? Do you see it in Reflector, when you open your assembly (it should be under Resources folder)?
I have images in one assembly which I want to share into another. I've used Add as Link in my second assembly. In the project where the actual image files are located they are in a Resources\Images folder. In the project which links to those files the links are also in a Resources\Images folder. At runtime a XamlParseException claiming "cannot locate resource" is thrown.
My xaml which is referencing the image is in a UserControls folder.
In the project which actually contains the images the path ..\Resources\Images\Blah.png works fine as expected.
Opening the DLLs in Reflector makes it obvious that in the assembly with the linked images holds the images at the root level - the compiler is not respecting the folder location. So in the project with the linked files I have to use ..\Blah.png to find the resource.
Surely a bug in the compiler?
_http://www.mscui.net/PatientJourneyDemonstrator/PrimaryCare.htm
I want to create/design the similar to above site/url using silverlight.
For this I have created separate user controls(Xaml files). Please advice me the steps/way to proceed in silveright. I am using silverlight versin 2.
I am thinking to use Wrappanel to adjust all the xmal files in Home page/default page. so that I can navigate to any page.
You can grab the XAP from your internet cache, open it with any zip tool and then use something like reflector to look in the DLLs to get the XAML out, should you desire to see how they did it themselves.
There's actually a project on codeplex which demonstrates how to do this dashpart effect with full source code called blacklight, so the above is probably not necessary.
I'm in the process of building a Home Theatre PC (HTPC), and figured this could give me a small project to learn some more about WPF.
I want to build a simple program launcher. It would be an application that would fill the screen with a background of my choosing, and a few large icons/buttons to represent applications. I have an IR remote that will be set up to emulate keystrokes, so I can use the "keyboard" to move between the large buttons and "click" one of them, launching a program.
I'd like to define my button info, images, and background using some kind of external config file and image files in the same folder as the exe.
I've been playing around with the idea in VS2008 using VB but already I'm getting stuck with just trying to get an external image file to appear on a button. Many of the samples I find are relatively complicated and are written in C#, but I work in VB. If anyone has suggestions for getting over this hurdle or ideas on how I should approach other parts of my application, your input is welcome.
Thanks!
Try working your way through this series:
A First Introduction to WPF and XAML for Visual Basic Programmers
Good intro recommended in the first answer - if you want to go a bit deeper have a look at WPF - how and why