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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:03:56+00:00 2026-06-06T00:03:56+00:00

Recently, I decided to play with Windows Presentation Foundation and create a variation of

  • 0

Recently, I decided to play with Windows Presentation Foundation and create a variation of chess. The whole thing is kinda done (I believe) but it’s a long time now as I can’t find a way to set my PNG file as a Image control. This is exemplary class which is affected by a issue:

public class Field
{
    public Image Image { get; set; }

    public Image GetImage(String keyName)
    {
        ResourceDictionary imagesDictionary = new ResourceDictionary();
        imagesDictionary.Source = new Uri("file:/[...]/ImagesDictionary.xaml");
        var var = imagesDictionary[keyName];
        Image image = (Image) imagesDictionary[keyName];
        return image;
    }

    public void RefreshImage()
    {
        if (Unit.Subclass.CompareTo("Bishop").Equals(0))
        {
            if (Unit.Player.IsWhite)
            {
                this.Image = this.GetImage("WhiteBishop");
            }
            ...
    }

}

My ImagesDictionary.xaml file:

<ResourceDictionary>
    <ImageSource x:Key="BlackBishop">BlackBishop.png</ImageSource>
    <ImageSource x:Key="WhiteBishop">WhiteBishop.png</ImageSource>
    ...
</ResourceDictionary>

And the issue is that I don’t know how to convert the output of GetImage

(System.Windows.Media.Imaging.BitmapFrameDecode)

into the

(System.Windows.Controls.Image)

Any ideas?

  • 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-06T00:03:57+00:00Added an answer on June 6, 2026 at 12:03 am

    System.Windows.Media.Imaging.BitmapFrame is derived from ImageSource.

    You should be able to do this:

    this.Image = new Image();
    this.Image.Source = this.GetImage("WhiteBishop");
    

    or

    this.Image.Source = this.GetImage("WhiteBishop").Source;
    

    If BitmapFrameDecode is truly derived from System.Windows.Imaging.Image, not from ImageSource.

    -Jesse

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

Sidebar

Related Questions

I was recently going through a garbage collection article and decided to play along
I recently decided to incorporate PHP into my website, but I've never worked with
I've recently decided to subclass my sprite, but I am a bit clueless on
I've been programming for a while, but just recently decided to start developing for
Recently decided to write a quick windows form app to tag my MP3 files.
I recently decided to go into WP7 app development, but haven't actually started learning
I've always ignored the need for LINQ by iterating over objects but recently decided
I have an input field that was written with onfocus=this.value='' , but recently decided
Recently I decided to work with Rx (Reactive Extensions) for Windows Phone 7 and
I built a website recently, and decided to create buttons that depress on click

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.