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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:00:39+00:00 2026-05-19T02:00:39+00:00

I am currently developing an application in C# using WPF. What I need to

  • 0

I am currently developing an application in C# using WPF. What I need to be able to do is on a label make their be an image to the left of the text of the label a small image of an X or a small image of a tick depending on the circumstances. I have got the images included in the project in a folder named images.

How can I assign the images to be placed on the left of the label programatically in the code and not using the XAML 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-05-19T02:00:40+00:00Added an answer on May 19, 2026 at 2:00 am

    Since you want this in code behind and not within XAML I would suggest ditching the Label and using a StackPanel coupled with an Image and TextBlock as seen below where MyGrid could be any container…

            <Grid Name="MyGrid"/>
    

    …then in your code behind…

            StackPanel myStackPanel = new StackPanel();
            myStackPanel.Orientation = Orientation.Horizontal;
    
            Image myImage = new Image();
            BitmapImage myImageSource = new BitmapImage(); 
            myImageSource.BeginInit();
            myImageSource.UriSource = new Uri("Images/MyImage.png");
            myImageSource.EndInit();
            myImage.Source = myImageSource;
    
            TextBlock myTextBlock = new TextBlock();
            myTextBlock.Text = "This is my image";
    
            myStackPanel.Children.Add(myImage);
            myStackPanel.Children.Add(myTextBlock);
    
            MyGrid.Children.Add(myStackPanel);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently developing an application in C# using WPF. I need the program
I'm currently developing a small WPF application using a file database (SQLCe). Since I'm
I'm currently developing a small application in WPF for us at work though I'm
I am currently developing an application in C# using WPF, I have always only
I'm currently developing a touch screen application using C# (.NET 4.0) and WPF for
I'm currently developing a web application using MYSQL database InnoDB format and need some
Currently developing an application using the newest version of symfony, obtained through PEAR. This
I am currently developing an android application using eclipse and I already have a
I'm currently developing a simple iPhone application using a UITabBar and table views for
I'm currently developing an Android application that fetches images using http requests. It would

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.