On 08/07/2010 21:21, Rob Brown-Bayliss wrote:
Hi

I am using visual studio 2010 and the iron python tools.

How do I place an image in a dialog?

I have this in my xaml:

<Image Name="pm_logo" Grid.Row='0'>
             <Image.Source>
                 <BitmapImage UriSource="/Images/pm.png"></BitmapImage>
             </Image.Source>
         </Image>

and in the project directory I have the Images folder and the png
image.  But nothing shows when I run the app.

Is it preferable to add the images in code or is xaml the correct place?
The URI syntax for loading images from the filesystem is truly horrible and requires you to specify absolute paths I believe. It is easier from C# as you can refer to them statically as embedded resources (or something like that).

If I recall correctly, in IronPython in Action I do it by preprocessing the xaml to insert the absolute path in the correct syntax before loading the xaml. Doing it from code is the other alternative.

All the best,

Michael

--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of 
your employer, to release me from all obligations and waivers arising from any 
and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, 
clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and 
acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your 
employer, its partners, licensors, agents and assigns, in perpetuity, without 
prejudice to my ongoing rights and privileges. You further represent that you 
have the authority to release me from any BOGUS AGREEMENTS on behalf of your 
employer.


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to