Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Binding Image to a window

Binding Image to a window

Scheduled Pinned Locked Moved WPF
wpfcsharpwcfcomquestion
8 Posts 5 Posters 25 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AAKAra
    wrote on last edited by
    #1

    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 P 2 Replies Last reply
    0
    • A AAKAra

      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 Offline
      I Offline
      Insincere Dave
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • A AAKAra

        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

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        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.

        My blog | My articles

        A 1 Reply Last reply
        0
        • P Pete OHanlon

          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.

          My blog | My articles

          A Offline
          A Offline
          AAKAra
          wrote on last edited by
          #4

          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

          P 1 Reply Last reply
          0
          • A AAKAra

            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

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            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.

            My blog | My articles

            L 1 Reply Last reply
            0
            • P Pete OHanlon

              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.

              My blog | My articles

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              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 Articles

              Just a grain of sand on the worlds beaches.

              P 1 Reply Last reply
              0
              • L Lost User

                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 Articles

                Just a grain of sand on the worlds beaches.

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #7

                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.

                My blog | My articles

                J 1 Reply Last reply
                0
                • P Pete OHanlon

                  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.

                  My blog | My articles

                  J Offline
                  J Offline
                  Jammer 0
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups