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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:04:36+00:00 2026-05-29T20:04:36+00:00

Im currently developing an Windows Phone 7.0 Application with C#. I got an Listbox

  • 0

Im currently developing an Windows Phone 7.0 Application with C#. I got an Listbox whichs items is based on the results of an WCF-Service. I’ve created my own object which contains a few values that have been fetched from an database. The problem is that i don’t know how to change the content of each Listbox Item depending on the values of that items parameters that was fetched using the webservice.

Structure:

  • User enters the XAML Page
  • An connection is being opened between the client and the webservice
  • The webservice returns an List<Friend> The important parameter inside Friend is called Verified
  • The listbox items is set using: lstFriends.ItemsSource = e.Result;

What i want to do:

  • I want to check in each Listbox Item after the parameter Verified and check it’s value.
  • Depending on if the parameter is true or false a TextBlock inside the Listbox Item should have different text.

Thanks

  • 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-29T20:04:38+00:00Added an answer on May 29, 2026 at 8:04 pm

    This is probably an ugly way to do it with no code-behind, but what you could do is create a template for your listboxitem that includes two textblocks (something) like this:

    <Style x:Key="ListBoxItemStyle1" TargetType="ListBoxItem">
            <Setter Properties... />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <TextBlock Text="Verified" Visibility={Binding Verified, Converter="{StaticResource BoolToVisibilityConverter}"  />
                        <TextBlock Text="Not Verified" Visibility={Binding Verified, Converter="{StaticResource ReverseBoolToVisibilityConverter}" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    

    You would then have to write two converters: BoolToVisibilityConverter to change the boolean value of Verified to Visible if True and Collapsed if False for the first text block and ReverseBoolToVisibilityConverter to change the boolean value of Verified to Visible if False and Collapsed if True on the second text block. This way one textblock will always be visible in the listboxitem and one will always be collapsed, depending on the value of the Verified property.

    If you don’t know how to do value converters, you can look HERE.

    This isn’t tested and is not all of the code you’d need, but it should work. This assumes that the two different text blocks will always contain the same text and that the Verified property is a boolean property, if not then you might want to figure out another way to do it.

    On second thought, you could just do ONE value converter and one textblock and convert the value of Verified to the text you want. That would be easier.

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

Sidebar

Related Questions

I'm currently developing a WCF service self hosted in a Windows service with the
I am developing a Windows Phone 7 Silverlight application that currently displays a map
Currently developing an application for Windows Phone that makes use of the bing maps
I'm currently developing an application in C# for Windows Phone against an HTTPS web
We are currently developing a Windows Forms application in VS 2008 C#. This application
I am currently developing an application for Windows CE on the TI OMAP processor,
I am currently developing an approval routing WCF service that will allow an user
I am developing a windows phone application which allows user to download files from
I'm currently developing a application where I will have multiple windows open using C#
I am currently developing a C# Windows Form Application. After the user has login

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.