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

  • SEARCH
  • Home
  • 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 7081655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:56:52+00:00 2026-05-28T06:56:52+00:00

I have a databound object within a WPF control that is ‘previewing’ a mutlipage

  • 0

I have a databound object within a WPF control that is ‘previewing’ a mutlipage tiff.

The object has a public PreviewImage, and CurrentPreviewPage.

It has a private PreviewPages which is a collection of MemoryStreams (each representing a page of the Tiff).

Upon the get of the PreviewImage (the first time) this code runs:

if (PreviewPages.Count == 0)
{
    Image myImg = System.Drawing.Image.FromFile(_LocalFile);

    for (int i = 0; i < (NumberOfPages); i++)
    {
        myImg.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, i);
        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        myImg.Save(ms, System.Drawing.Imaging.ImageFormat.Tiff);
        PreviewPages.Add(ms);
    }
}

The previous code takes about 10 seconds to run for a 1100KB 17 page TIFF. There must be a better way of handling this.
Afterwards, this is called:

BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.DecodePixelWidth = 1000;
//bi.UriSource = new Uri(fiTemp.FullName);
bi.StreamSource = new System.IO.MemoryStream(PreviewPages[CurrentPreviewPage - 1].ToArray());
bi.EndInit();
_PreviewImage = bi;

Now, after the initialization this code works fantastically (it can change pages as fast as you can drag a bound slider). Any help would be much appreciated.

  • 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-05-28T06:56:52+00:00Added an answer on May 28, 2026 at 6:56 am

    Load your first page on the primary thread and then additional pages in the background – see BackGroundWorker. Only primary thread can access the UI. On the BackGroundWorker you need to decide if you are going to get the pages 2-x one at a time or all at once. The user cannot get to page 2 until you bring page 2 to the UI thread. I would implement cancel. If the user gives up you don’t want to tie up CPU.

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

Sidebar

Related Questions

I have a form that is has many controls databound to a object with
I have a basic form with controls that are databound to an object implementing
I have a combobox in my WPF app that is databound to my list
I have a listbox that is databound to a Collection of objects. The listbox
I have a databound TextBlock control (which is being used inside a DataTemplate to
I have a simple ASP page with databound grid (bound to an object source).
within an asp.net webform project I have a session variable that I am populating
I have a standart Page within my ListView control on the page, And the
I have a databound WPF comboxbox where I am using the SelectedValuePath property to
I have an ASP.NET GridView which has columns that look like this: | Foo

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.