none
Scrolling an image in WPF RRS feed

  • Question

  • Hello, please help.

    I need to perform a scrolling on an image. When I have a bitmap image that is too large to fit in its containing control (Image Control) I want to have a scroll bar so I can scroll the image vertically and horizontally inside the containing control and see the rest of the large image. I've been researching, but still haven't found a clue on how to do this... every example shows a scrolling of a document (text), but that doesn't help me. Hope someone can get me around this.

    Thanks and best regards,
    Diego V.
    Wednesday, March 14, 2007 7:46 PM

Answers

  • <ScrollViewer>

      <Image Source="MYIMAGE.JPG " />

    </ScrollViewer>

     

    or..

     

    ScrollViewer sv = new ScrollVIewer();

     

    Image img = new Image();

    BitmapImage imgdata;

    imgdata = new BitmapImage(new Uri("MYIMAGE.JPG", UriKind.RelativeOrAbsolute));

    img.Source = imgdata;

     

    sv.Content = img;

    Thursday, March 15, 2007 2:35 PM

All replies

  • did you try adding Image to a scrollviewer?
    Wednesday, March 14, 2007 7:52 PM
    Moderator
  • No, and I would appreciate it if you can guide on how to "add" Image to a ScrollViewer.
    Thanks!
    Wednesday, March 14, 2007 8:05 PM
  • <ScrollViewer>

      <Image Source="MYIMAGE.JPG " />

    </ScrollViewer>

     

    or..

     

    ScrollViewer sv = new ScrollVIewer();

     

    Image img = new Image();

    BitmapImage imgdata;

    imgdata = new BitmapImage(new Uri("MYIMAGE.JPG", UriKind.RelativeOrAbsolute));

    img.Source = imgdata;

     

    sv.Content = img;

    Thursday, March 15, 2007 2:35 PM