Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8702121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:34:20+00:00 2026-06-13T02:34:20+00:00

I am having troubles displaying my pop-up from inside a different thread. I have

  • 0

I am having troubles displaying my pop-up from inside a different thread. I have tried reading some of the other questions on here, but I can’t see to understand how I can apply them…

I have an app that uses the camera, and I want to pop up a preview of the picture after its available.

The PhotoCamera has the event ‘CaptureImageAvailable’ and in there I want to pop-up the preview

private void cam_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
    {
        BitmapImage img = new BitmapImage();
        img.SetSource(e.ImageStream);
        e.ImageStream.Close();

        //creating the new pop-up preview
        Grid panelPreview = new Grid();
        panelPreview.Background = new SolidColorBrush(Colors.Black);
        panelPreview.Width = 300;
        panelPreview.Height = 400;

        //create an ImageBrush to display the image in the new pop-up
        ImageBrush imgPreview = new ImageBrush();
        imgPreview.ImageSource = img;

        //need a rectangle to add the image to, otherwise can't add it
        Rectangle rect = new Rectangle();
        rect.Width = 300;
        rect.Height = 400;
        rect.Fill = imgPreview;

        //Adding the rectangle to the grid
        panelPreview.Children.Add(rect);

        imagePreview.IsOpen = true;

        ....
    }

This causes an UnauthorizedAcessException, which makes sense to me, because this event is on a different thread, but what I don’t understand is how to fix it… I have tried using this code as well

private void cam_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
    {

        Deployment.Current.Dispatcher.BeginInvoke(delegate()
        {

            BitmapImage img = new BitmapImage();
            img.SetSource(e.ImageStream);
            e.ImageStream.Close();

            //creating the new pop-up preview
            Grid panelPreview = new Grid();
            panelPreview.Background = new SolidColorBrush(Colors.Black);
            panelPreview.Width = 300;
            panelPreview.Height = 400;

            //create an ImageBrush to display the image in the new pop-up
            ImageBrush imgPreview = new ImageBrush();
            imgPreview.ImageSource = img;

            //need a rectangle to add the image to, otherwise can't add it
            Rectangle rect = new Rectangle();
            rect.Width = 300;
            rect.Height = 400;
            rect.Fill = imgPreview;

            //Adding the rectangle to the grid
            panelPreview.Children.Add(rect);

            imagePreview.IsOpen = true;
        });

This method doesn’t throw any errors, but also doesn’t appear to actually do anything. How do I display this pop-up on the UI thread?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:34:21+00:00Added an answer on June 13, 2026 at 2:34 am

    What is “imagePreview”?

    If it is anykind of popup or image element container than u must add “panelPreview” as it’s child ,so that it become visible on UI.

    One more thing, u can use thumbnail image(via

    private void cam_CaptureThumbnailAvailable(object sender,
    ContentReadyEventArgs e)

    ) for viewing on popup which will take very less memory than actual image.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

guys am having some troubles with running out of memory when displaying an animation
I am having trouble displaying results recieved from asp.net WebMethod. I have a HTML
I'm having some troubles with binding data. I have an application that contains a
I am having trouble displaying a webview. I have a webview inside a custom
I'm having some troubles with displaying a graph. It's a very strange issue, because
I am having trouble displaying some jason from a page. The data is there
I'm having some trouble displaying HTML5 video in IE9, I added the different types
I'm having trouble with displaying image from db. I think that method for saving
I am having trouble passing the return value from TheMethod() to Main and displaying
My Java application is displaying some odd behaviour, and I'm having trouble finding a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.