+1  A: 

Aha! The problem is the TextBlock txtLabel that is directly above the InkCanvas. When you remove that the black line disappears.

As for why that is happening, I'm not entirely sure yet.

Charlie
thanks! - that seemed to do the trick. Wish I understood why too. I guess I'll remove the TextBlock for now and try it again later when I have more time to delve into this.
Jason
It's doing this because you're using a StackPanel. The various layout panels do some sneaky stuff to your controls... in your case you're most likely seeing an offset transform being applied to your InkCanvas. I think you can get around it by putting your InkCanvas in a Border. See this link for more info: http://blogs.msdn.com/jaimer/archive/2009/07/03/rendertargetbitmap-tips.aspx
Adam Sills
A: 

Jason i solvo this problem. Sorry my English. i am Russian. You need set property inkCanvas.Margin is 0,0,0,0 that surface.Margin = new Thickness(0, 0, 0, 0); after saving set margin in you posicion

exaple: i nave

surface.Margin = new Thickness(0, 0, 0, 0); http://img189.imageshack.us/img189/7499/mynewimage.png

ScarX
A: 

and surface.Margin = new Thickness(55,40,96,5); http://img519.imageshack.us/img519/7499/mynewimage.png

ScarX
A: 

My class save image

     using System;
     using System.IO;
     using System.Windows;
     using System.Windows.Controls;
     using System.Windows.Media;
     using System.Windows.Media.Imaging;

     public void ExportToJpeg(String path,  InkCanvas surface)
    {
        double
                x1 = surface.Margin.Left,
                x2 = surface.Margin.Top,
                x3 = surface.Margin.Right,
                x4 = surface.Margin.Bottom;

        if (path == null) return;

        surface.Margin = new Thickness(0, 0, 0, 0);

      Size size = new Size(surface.Width, surface.Height);
   surface.Measure(size);
   surface.Arrange(new Rect(size));

         RenderTargetBitmap renderBitmap =
          new RenderTargetBitmap(
            (int)size.Width,
            (int)size.Height,
            96,
            96,
            PixelFormats.Default);
      renderBitmap.Render(surface);
      using (FileStream fs = File.Open(path, FileMode.Create))
        {
         JpegBitmapEncoder encoder = new JpegBitmapEncoder();
            encoder.Frames.Add(BitmapFrame.Create(renderBitmap));
            encoder.Save(fs);
        }
      surface.Margin = new Thickness(x1, x2, x3, x4);
    }
ScarX
A: 

Thanks! I have been thinking of this problem lately.

Now i can see a very thin border around the saved image but when i save the image as PNG, GIF or BMP i see no border at all. Why so?

Any help appreciated.

anupma
Thanks everyone!
anupma