Zoompanel image file formats
#1
I have a ZoomPanel on a Window containing a Frame (ZoomPanelContentFrame) and I am trying to show various images in it for zooming. All works fine with the provided tiger.xaml file but when I try to set the source to a Uri for a .png file all goes bad.
I get An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll.
Additional information: Failed to convert resource into object.

Is there support for .png files or do I need to convert my 100s of png files to some other format? I have not run across anything in the documentation for this (or if I did I didn't realize it).

Any help would be appreciated.
TIA,
Lou
#2
ZoomPanel can be used to zoom and pan any WPF content.

In WPF Frame conrtrol is used to show other XAML pages.
If you would like to show png images in WPF you should use Image control - just set its Source property and put it inside ZoomPanel - for example:

<Image ... Source="Resources/Image.png"/>

This works when the image's Build Action is set to Resource.
If the file's Build Action is set to Contant and its "Copy to output directory" is set to "Copy if newer" or "Copy always" than the Source need to be "/Resources/Image.png".

WPF is using a so called Pack URI shema to specify resource names - see internet for more information. For example: http://stackoverflow.com/questions/34761...-resources
Andrej Benedik
#3
Thanks.

I did manage to use the image control in the ZoomPanel to work already but today is the first day that I have been able to sign on and reply to my own question (even though I see my user name has changed).

Since I am using a bitmap format I do need to crank up the resolution so the zoomed image still looks good but high res cameras are relatively inexpensive so that is not a issue.

Thanks Again,
Lou
  


Forum Jump:


Users browsing this thread:
1 Guest(s)