private void btncaprture_Click(object sender, RoutedEventArgs e) { if (MyIP.Strokes != null && MyIP.Strokes.Count > 0) { WriteableBitmap wbBitmap = new WriteableBitmap(MyIP, new TranslateTransform()); EditableImage eiImage = new EditableImage(wbBitmap.PixelWidth, wbBitmap.PixelHeight); try { for (int y = 0; y < wbBitmap.PixelHeight; ++y) { for (int x = 0; x < wbBitmap.PixelWidth; ++x) { int pixel = wbBitmap.Pixels[wbBitmap.PixelWidth * y + x]; eiImage.SetPixel(x, y, (byte)((pixel >> 16) & 0xFF), (byte)((pixel >> 8) & 0xFF), (byte)(pixel & 0xFF), (byte)((pixel >> 24) & 0xFF) ); } } } catch (System.Security.SecurityException) { throw new Exception("Cannot print images from other domains"); } // Save it to disk Stream streamPNG = eiImage.GetStream(); StreamReader srPNG = new StreamReader(streamPNG); byte[] baBinaryData = new Byte[streamPNG.Length]; long bytesRead = streamPNG.Read(baBinaryData, 0, (int)streamPNG.Length); IsolatedStorageFileStream isfStream = new IsolatedStorageFileStream("tempsignature.png", FileMode.Create, IsolatedStorageFile.GetUserStoreForApplication()); isfStream.Write(baBinaryData, 0, baBinaryData.Length); isfStream.Close(); //Show to image isfStream = new IsolatedStorageFileStream("tempsignature.png", FileMode.Open, IsolatedStorageFile.GetUserStoreForApplication()); biImage.SetSource(isfStream); isfStream.Close(); ucImg.Visibility = Visibility.Visible; ucImg.SignCapture.Source = biImage; savebtn.IsEnabled = true; TitlePanel.IsHitTestVisible = false; ContentPanel.IsHitTestVisible = false; } else { MessageBox.Show("Note:There is no signature line to capture!"); } }