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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:22:30+00:00 2026-05-28T02:22:30+00:00

I have an image name as a string. The real imagename on the form

  • 0

I have an image name as a string. The real imagename on the form is called “image”. So i get something like this:

    image.Visibility = Visibility.Hidden;

string imageName = "image";
// need something here to make it usable...

changedImageName.Visibility = Visibility.Visible;

Now, a string can not be used in combination with the Visibility property.
I cant really find what i must make the string to, to make it usable for the visibility property.
If i see this page: http://msdn.microsoft.com/en-us/library/system.windows.visibility.aspx
Do I understand correct that I make it a “enum” ? And if yes, how do I get a string to that property?

EDIT 1

I see I have not been explaining it proper enough.
I forgot to mention I am using a WPF form.
on this form, I have put an image.

In the initialize part, the image get set to hidden.
so for example the imagename I named “Image”
so I use image.Visibility = Visibility.Hidden;

later on in my code, I want to make the image visible again, depending on what the user does.
so, instead if just using the name to get the image visible again, I want to use a string.
this string is looking exactly as the name of the image.
but i cant use the string in combination with the Visibility function.
but i cant find anywhere what i must make this string to, to be able to use that visibility option on it.
hope i explained a bit better now :).

Later on, i will have multiple images on the WPF window.
So the key is that i will use the string, that is corresponding with the name of the image.
Depending on what the user has input into the string, some image will or will not show.

EDIT 2

If you have:

String theName = ImageName.name

you can get the name of the image into a string, so you can do stuff with it.
i am looking for a way to do the exact opposite of this. So i want to go from a string, to that name, so after that i can use this to control the image again.

Edit 3

some example:

        private void theButton_Click(object sender, RoutedEventArgs e)
        {

            //get the Name property of the button
            Button b = sender as Button;
            string s = b.Name;

            MessageBox.Show("this is the name of the clicked button: " + s);

            //the name of the image to unhide, is the exact same as the button, only with IM in front so:
            string IM = "IM";
            IM += s;

            MessageBox.Show("this string, is now indentical to the name of the image i want to unhide, so this string now looks like: " + IM );

            // now, this wont work, because i cant use a string for this, although the string value looks exactly like the image .name property
            // so string IM = IMtheButton
            // the image to unhide is named: IMtheButton.name
            IM.Visibility = Visibility.Visible;
}
  • 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-28T02:22:31+00:00Added an answer on May 28, 2026 at 2:22 am

    looks like you’re using WPF, so you can create a boolean to visibility converter and use it with a boolean (and create a method that receives string if necessary) and just use:

    <ContentControl Visibility="{Binding Path=IsControlVisible, Converter={StaticResource BooleanToVisibilityConverter}}"></ContentControl>
    

    or any other converter…

    check this links:
    http://bembengarifin.wordpress.com/2009/08/12/setting-visibility-of-wpf-control-through-binding/

    http://andu-goes-west.blogspot.com/2009/05/wpf-boolean-to-visibility-converter.html

    http://msdn.microsoft.com/en-us/library/system.windows.controls.booleantovisibilityconverter.aspx

    EDIT 1:

    so then you will have to iterate over the images and check if your string is equals to name of the Image class.

    something like this (not tested):

    foreach (Image img in container.Items)
    {
        if img.Name == yourMagicallyString;
        {
            img.Visibility = Visibility.Visible;
        }
    else 
        {
            img.Visibility = Visibility.Hidden;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this service with RESTeasy: @GET @Path(/{name}) @Produces(image/jpeg) public BufferedImage get(@PathParam(name) String name)
We have an url like http://site.s3.amazonaws.com/images/some image @name.jpg inside $string What I'm trying to
Suppose I have string Name and Image Photo as properties of a class in
I have hierarchy: public class Parameter { public string Name { get; set; }
I have a url (http://www.something.com/subdirectory/image.jpg) and I would like to split the url into
hi i have a userControl with this property : public string UserImg { get;
I have a view where I am showing image and image name in a
I have a collection of objects which describe an image-name, its size and it's
In my database I have table AnimalDetails containing animalNumber(primary key),name,breed dateofbirth and an image
I need to download images from a website, and I have the login name

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.