c# - Set Image Source with generated RenderTargetBitmap from background thread -


I am applying a blur in a background thread to increase the performance. This function is a RenderTargetBitmap Returning when this is done I am using an update on the image through the Dispatcher and add it as a content on the page, it is done as follows:

  System Windows Control. Image Image = New System Windows Control. Image (); Thread screenshot thread = new thread (new (delegate) (RenderTargetBitmap img = CaptureScreen (0, 0, real wide, realhite); // system. Control Image (); Application Present Dispatcher. Invoc (() => {image.Source = img; image.Width = realWidth; Image .hit = Actual Hight; Page Container. Child Add (Image);} );})); ScreenshotThread.SetApartmentState (ApartmentState.STA); ScreenshotThread.Start ();  

I am adding an image to the page container, this is a grid. After running this piece of code, the image has been added to the page. However, the imagesource is zero. No image is currently visible. How do I reveal this image?

You have created Imagecontrol and the RenderTab Sitemap < / Code> I'm surprised you did not get an exception. Before setting it to Image.Source , img.Freeze (); Try adding.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -