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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:00:26+00:00 2026-06-07T01:00:26+00:00

I have bitmap image variable and i want to bind it to my xaml

  • 0

I have bitmap image variable and i want to bind it to my xaml window.

System.Reflection.Assembly thisExe;
        thisExe = System.Reflection.Assembly.GetExecutingAssembly();
        string[] resources = thisExe.GetManifestResourceNames();
        var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SplashDemo.Resources.Untitled-100000.png");
        Bitmap image = new Bitmap(stream);

And this is my xaml code

<Image Source="{Binding Source}" HorizontalAlignment="Left"  Height="210" Margin="35,10,0,0" VerticalAlignment="Top" Width="335">
    </Image>

can u assist me binding this bitmap variable to this xaml image by C# code?

  • 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-07T01:00:27+00:00Added an answer on June 7, 2026 at 1:00 am

    If you really want to set it from C# code and not from inside XAML, you should use this easy solution described further on the MSDN reference:

    string path = "Resources/Untitled-100000.png";
    BitmapImage bitmap = new BitmapImage(new Uri(path, UriKind.Relative));
    image.Source = bitmap;
    

    But first, you need to give your Image a name so you can reference it from c#:

    <Image x:Name="image" ... />
    

    No need to reference Windows Forms classes.
    If you insist on having the Image embedded into your Assembly, you need the following more lengthy code to load the image:

    string path = "SplashDemo.Resources.Untitled-100000.png";
    using (Stream fileStream = GetType().Assembly.GetManifestResourceStream(path))
    {
        PngBitmapDecoder bitmapDecoder = new PngBitmapDecoder(fileStream,
            BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
        ImageSource imageSource = bitmapDecoder.Frames[0];
        image.Source = imageSource;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bitmap image context and want to let this appear blurry. So
I have a Base64 String that represents a BitMap image. I need to transform
Hi i have a bitmap image data stored in a variable , i need
I have the following XAML: <Window.Resources> <myApp:ImageDisplayConvertor x:Key=ImageDisplayConvertor /> </Window.Resources> <DataGridTemplateColumn Header=Icon> <DataGridTemplateColumn.CellTemplate >
I have a view. I want to place a bitmap image as its background
I have a PNG image that has an unsupported bitmap graphics context pixel format.
I have a BMP image and I wish to convert it into a Bitmap
I have a Bitmap that I want to enlarge programatically to ~1.5x or 2x
I am trying to use the Notification.Builder.setLargeIcon(bitmap) that takes a bitmap image. I have
In asp.net, we have uploaded a .jpeg file and saved this as bitmap image

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.