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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:51:15+00:00 2026-05-23T15:51:15+00:00

WPF application, .NET 3.5. I have a ListView control, to which I bind a

  • 0

WPF application, .NET 3.5.

I have a ListView control, to which I bind a collection of business classes.

I’d like to bind the ForeColor of items to a bool property of the class (say: MyClass.Active), so that the items are displayed in black when active, in light gray when disabled.

I want listview items to change their color on-the-fly, I mean when I’d change Active value of one of the instances in my databound collection, its respective listview item would change its color automatically.

What do I need to achieve this? I’ve found numerous tutorials on WPF databinding on the net, some questions on StackOverflow, but not exactly the same thing, and I don’t want to start combining my solution out of everything I can put my hands on, by trial and error.

I know about INotifyPropertyChanged (for my business class), IValueConverter (but should I need it for a bool??), DataTrigger etc.

But which pieces of the puzzle do I really need, what is the simpliest way to achieve my goal?

  • 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-23T15:51:15+00:00Added an answer on May 23, 2026 at 3:51 pm

    I would just do it in a style, and apply that style on your List items. Providing that your object implements INotifyPropertyChanged and the property changed event gets raised when IsActive changes, this will change the foreground to Gray if IsActive = False

    <Style x:Key="DisableInactiveTextStyle" TargetType="{x:Type TextBlock}">
        <Setter Property="Foreground" Value="Black" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsActive}" Value="False">
                <Setter Property="Foreground" Value="LightGray" />
            </DataTrigger>
        </Style.Trigger>
    </Style>
    
    <TextBlock Style="{StaticResource DisableInactiveTextStyle}" ... />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF application targetting the .NET 4.0 Client Profile which needs to
I have a WPF application in which I use entity framework with mysql connector/net
I have a WPF application (.NET 3.0, VS2008) that displays data in a tab
I have a .Net 4.0 WPF application that requires an embedded database. MS Access
I have a desktop .NET WPF application witch uses an embedded database (SQLite). Where
We have created a beautifully designed .NET WPF desktop application. We are installing the
I have a WPF .NET 3.5 SP1 application that is in use on at
I have a ListView in my WPF application. my ListViewItem s are just Images.
I have a WPF application (.NET Framework 4) with a custom window-border. I've disabled
I have been using an MSI to install a WPF application using the .NET

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.