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 8928367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:25:23+00:00 2026-06-15T08:25:23+00:00

After much research I am stuck as I’m not able to make an image

  • 0

After much research I am stuck as I’m not able to make an image appear dynamically.

It is pretty much the same problem as this: Dynamic loading of images in WPF

Here is my actual code at the moment

Dim logo As New Image
        Dim logoSource As New BitmapImage
        logoSource.BeginInit()
        logoSource.UriSource = New Uri("../../Images/CarpeDiemLogo.gif", UriKind.Relative)
        logoSource.CacheOption = BitmapCacheOption.OnLoad
        logoSource.EndInit()

        logo.Height = 109
        logo.Width = 172
        logo.HorizontalAlignment = Windows.HorizontalAlignment.Right
        logo.VerticalAlignment = Windows.VerticalAlignment.Top
        logo.Source = logoSource
        logo.Stretch = Stretch.Uniform
g.Children.Add(logo)'Where g is a grid

As you can see it is quite similar yet I run into a problem.
I am trying to add the image to a user control used as an header template for printing using this print engine: http://www.codeproject.com/Articles/238135/WPF-Print-Engine-Part-I

At some point in the print engine it passes this code of line

var header = XamlReader.Parse(PrintTableDefination.HeaderTemplate) as FrameworkElement;

If logoSource.CacheOption = BitmapCacheOption.OnLoad is not commented it tells me “‘The initialization of ‘System.Windows.Media.Imaging.BitmapImage’ raised an exception’ line and line position 826.”

However if that line is comented it goes through but th eimage is not displayed.

Is there something I’m doing wrong? Limitations of the Xaml reader? I’ve searched and tried with different methods for creating the image dynamically and yet none of them loaded it.

Any suggestions will be considered and tried. I’m desperate at the moment…

Thanks

  • 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-15T08:25:24+00:00Added an answer on June 15, 2026 at 8:25 am

    I ended up modifying the source code of the print engine and passing to the function that prints the header a title where I’d replace “@title” found in the content of a label I’d put inside the header template.

    Sadly this doesn’t answer the initial question but yet it is a workaround for me.

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

Sidebar

Related Questions

After much research about the best way to save an image to a sqlite
After spending much time researching about this on Google, I could not come across
Not knowing the proper way, after much research on the web I found so
After much research and trial and error I found how to store the items
OK, after much research, and help with stackoverflow users, I've narrowed down how to
So I've decided after much debate and research to use symfony on my next
After much research I am a little confused by which identity tracker I should
I come to ask for your aid after a lot of research on this
I'm writing this after a good while of frustrating research, and I'm hoping someone
After much research I am still stumped. I have a serial port object which

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.