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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:25:50+00:00 2026-05-23T02:25:50+00:00

How do I bind a bool to select a specific image? For eg. I

  • 0

How do I bind a bool to select a specific image? For eg. I have My Image control. I have a binded property with the name of IsTrue.

I have 2 images:

  1. TrueImg.png
  2. FalseImg.png

How do I show an image based on bool?

Then how can I extend this to affect strings, such as “Male”, “Female”?

All images are located inside the silverlight app.

  • 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-23T02:25:51+00:00Added an answer on May 23, 2026 at 2:25 am

    Take a look the blog article A Generic Boolean Value Converter. With the code there in place you add this converter:-

     public class BoolToBitmapImageConverter : BoolToValueConverter<BitmapImage> { }
    

    Now add an instance of this to your Xaml:-

     <UserControl.Resource>
         <local:BoolToBitmapImageConverter x:Key="boolImgConv" >
             <local:BoolToBitmapImageConverter.TrueValue>
                 <BitmapImage UriSource="TrueImg.png" />
             </local:BoolToBitmapImageConverter.TrueValue>
             <local:BoolToBitmapImageConverter.FalseValue>
                 <BitmapImage UriSource="FalseImg.png" />
             </local:BoolToBitmapImageConverter.FalseValue>
         </local:BoolToBitmapImageConverter>
     </UserControl.Resource>     
    

    Now you can bind using this converter:

     <Image Source="{Binding YourBoolProp Converter={StaticResource boolImgConv}}" />
    

    Similarly you can add a converter for you strings:-

     <local:BoolToStringConverter x:Key="boolSex" FalseValue="Male" TrueValue="Female" />
    

    and:-

     <TextBlock Text="{Binding YouBoolProp Converter={StaticResource boolSex}}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a checkbox which i need to bind to a bool in the
I use to bind a bool variable of a class to a IsChecked property
I want to bind a buttons IsEnabled property to a bool value that is
I have a custom object that I am trying to bind to a control.
I'm trying to bind a list of custom objects to a WPF Image like
If I want to bind a collection to a some form of listing control
I want to bind Repeater control to Dataset which is filled with XML data,
I'm getting a compiler error with bind : using namespace std; bool odp(int arg1,
I have the following (C#) code namespace A { public interface IX { bool
I'm trying to bind a Dependency Property from my UserControl to my MainViewModel. This

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.