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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:05:18+00:00 2026-05-24T13:05:18+00:00

I need to have an image in my silverlight library and load it into

  • 0

I need to have an image in my silverlight library and load it into a bitmap. I want to just refer to it like a resource, but not sure how to go about it. I don’t have any xaml at all in this library, but what I read seems to indicate I need to do it with xaml.

Here is how I did it in a sample solution using the imageLoaded event. (you know how silverlight just loves async stuff!) The image properties is set to resource/copy always.

public partial class MainPage : UserControl
{
    WriteableBitmap myIcon = new WriteableBitmap(100, 100);

    public MainPage()
    {
        InitializeComponent();
        LoadImages();

    }

    public void LoadImages()
    {
        BitmapImage bmi = new BitmapImage();
        bmi.ImageOpened += ImagesLoaded;
        bmi.CreateOptions = BitmapCreateOptions.None;
        bmi.UriSource = new Uri(App.Current.Host.Source, "/ClientBin/HouseLogo.png");
    }


    public void ImagesLoaded(object sender, RoutedEventArgs e)
    {
        BitmapImage bm = (BitmapImage)sender;
        myIcon = new WriteableBitmap(bm);
    }

    private void btnPdf_Click(object sender, RoutedEventArgs e)
    {
        PDFdoc doc = new PDFdoc(32.0, 32.0, myIcon );
    }
}
  • 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-24T13:05:19+00:00Added an answer on May 24, 2026 at 1:05 pm

    First of all you say this is a silverlight library hence “Content” images are not useful, you will need to specify the “Resource” build action on your images in this library project. Hence the Url you need to access the image resource is something like “/YourLibraryNameDllName;component/Images/HouseLogo.png”. Where you have a folder in your project called “Images” where you are placing these pngs you want to load from your dll.

    With that in place you can load the png into a WriteableBitmap without the async pattern using this chunk of code.

     StreamResourceInfo sri = Application.GetResourceStream(new Uri("/YourLibraryNameDllName;component/Images/HouseLogo.png", UriKind.Relative));
     BitmapSource source = new BitmapImage();
     source.SetSource(sri.Stream);
    
     WriteableBitmap myIcon = new WriteableBitmap(source);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem in silverlight which I need to convert this image(from database
I need to have an image render with nearest-neighbor resizing and not the bicubic
I want to have an image fade out slowly on load. Idea is that
I have an image that I have in my bundle resources that I need
So here's my issue. I have an image that I need to shrink. The
I have a binary image with contour lines and need to purify each contour
I have a small image from a database and the image's average color need
I have a jpeg image in a char[] buffer in memory, all I need
I have a raw image buffer in the RGB format. I need to draw
I have custom map image with specific height and width. i need to map

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.