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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:47:04+00:00 2026-05-17T16:47:04+00:00

i am displaying images inside the list box. If the image URL doesn’t have

  • 0

i am displaying images inside the list box. If the image URL doesn’t have image means it will display textblock with Book title and Author name.

Problem: If the image is available i want to hide the textblock.

Code:

  <local:ImageConverter x:Key="myImageConverter"/>
    <Style x:Key="ListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Padding" Value="2,0,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Grid Width="150">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>

                        <Image HorizontalAlignment="Center" Grid.Row="0" VerticalAlignment="Center"  x:Name="img" Source="{Binding ImageUrl}" Height="74" Stretch="Fill" Width="75"/>

                            -<TextBlock Name="txtblkImg"  HorizontalAlignment="Center" VerticalAlignment="Center" Height="74" Width="75">
                        <TextBlock Text="{Binding Title}"/><LineBreak/>
                        <TextBlock Text="by "/>
                        <TextBlock Text="{Binding Author1}"/>
                                </TextBlock>                                                       

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
  • 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-17T16:47:05+00:00Added an answer on May 17, 2026 at 4:47 pm

    You can expose a boolean value in your ViewModel that describes whether or not the Image exists, then set the visibility on the three TextBlocks (or a panel wrapping them) to a binding on the image exists using a BooleanToVisibilityConverter.

    C#:

    public bool ImageUrlIsNotValid 
    {
        get 
        {
            // Test to see if the specified file exists
        } 
    }
    

    XAML:
    In the resources

    <BooleanToVisibilityConverter x:Key="boolToVisibilityConverter"/>
    

    and in the code shown above:

    <StackPanel Orientation="Horizontal" Visibility="{Binding ImageUrlIsNotValid, Converter={StaticResource boolToVisibilityConverter}}">
      <TextBlock Text="{Binding Title}"/><LineBreak/>
      <TextBlock Text="by "/>
      <TextBlock Text="{Binding Author1}"/>
    </StackPanel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have 2 ways of displaying images in a cell, which way will
I have a view that will be displaying downloaded images and text. I'd like
I am suing Listview and customize listview to display image inside a list item.
I have some bulk images inside DIV tag and If I click an image
I have an image control inside a grid displaying a 16x16 icon. But for
I have a top script displaying a list of users (will turn this script
I'm displaying images from outside my web root, like this: header('Content-type:image/png'); readfile($fullpath); The content-type:
This is a very common scenario: displaying images in a ListView which have to
i am using asynctask to fetch images from given url.these images are displaying in
I'm trying to display a number of images horizontally inside of a fixed-width div.

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.