Binding Image to a window
-
Hello, is there a way to Bind a image to a window? I have a button in my application which has a image, <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Image Source="c:\IMG_1861.JPG" Width="200" /> </Window> Resizing the window does not resize the image, instead it streches and crumbles the image. Is there a way to get away from this? Yes we can draw the Image using WPF that seem to be tedious as far as my application is corncerned, i tried using ViewBox is that the only way out? Sample application apreciated. With Rgds, Anil
-
Hello, is there a way to Bind a image to a window? I have a button in my application which has a image, <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Image Source="c:\IMG_1861.JPG" Width="200" /> </Window> Resizing the window does not resize the image, instead it streches and crumbles the image. Is there a way to get away from this? Yes we can draw the Image using WPF that seem to be tedious as far as my application is corncerned, i tried using ViewBox is that the only way out? Sample application apreciated. With Rgds, Anil
I'm not quite sure what you mean by crumbles the image, but if you don't specify the width it will take up the available space. Maybe the Stretch and MaxWidth properties can give you the behavior you want.
-
Hello, is there a way to Bind a image to a window? I have a button in my application which has a image, <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Image Source="c:\IMG_1861.JPG" Width="200" /> </Window> Resizing the window does not resize the image, instead it streches and crumbles the image. Is there a way to get away from this? Yes we can draw the Image using WPF that seem to be tedious as far as my application is corncerned, i tried using ViewBox is that the only way out? Sample application apreciated. With Rgds, Anil
The problem that you have is that this is a bitmapped image and not a vector image. If you want an image that scales well, it has to be a vector graphic because a vector graphic uses maths to manage the implementation of the image. When you resize your bitmapped image, it only has so much information to work with, so the image degrades once it is manipulated away from its usual dimensions. I'm afraid a ViewBox won't help you get round the limitations of your jpeg file.
Deja View - the feeling that you've seen this post before.
-
The problem that you have is that this is a bitmapped image and not a vector image. If you want an image that scales well, it has to be a vector graphic because a vector graphic uses maths to manage the implementation of the image. When you resize your bitmapped image, it only has so much information to work with, so the image degrades once it is manipulated away from its usual dimensions. I'm afraid a ViewBox won't help you get round the limitations of your jpeg file.
Deja View - the feeling that you've seen this post before.
-
Yes thats my problem. I need to convert the bitmap image to Vector graphics. This can be done using Adobe Illustrator using XAML plugin. Thanks Anil
AnilUnni wrote:
This can be done using Adobe Illustrator using XAML plugin
That's interesting. I didn't know that Illustrator could do that.
Deja View - the feeling that you've seen this post before.
-
AnilUnni wrote:
This can be done using Adobe Illustrator using XAML plugin
That's interesting. I didn't know that Illustrator could do that.
Deja View - the feeling that you've seen this post before.
Pete, Illustrator has a plug-in to export vector images and scenes to xaml. It works great. The converting of bitmpat images to vector article is a done by tracing, I have not seen one yet that does a great job on complex photos.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
-
Pete, Illustrator has a plug-in to export vector images and scenes to xaml. It works great. The converting of bitmpat images to vector article is a done by tracing, I have not seen one yet that does a great job on complex photos.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.
Karl Shifflett wrote:
Illustrator has a plug-in to export vector images and scenes to xaml. It works great.
Nice, although we are using Expression for our artwork (and looking into Zam3D based on Jammer's recommendation).
Deja View - the feeling that you've seen this post before.
-
Karl Shifflett wrote:
Illustrator has a plug-in to export vector images and scenes to xaml. It works great.
Nice, although we are using Expression for our artwork (and looking into Zam3D based on Jammer's recommendation).
Deja View - the feeling that you've seen this post before.
There are also utility apps for PSD - XAML converting, I've had limited success using this one here though as it can't handle complex PSD's. There are quite a few things potentially in a PSD that just don't map to any equivilent in XAML or WPF. I've been working with ZAM3D some more ... I'm even more impressed with it now than when I recommended it!!! I've had a few crashes which is unfortunate but to be expected with a v1 app I guess ...
Jammer Going where everyone here has gone before! :) My Blog