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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:28:51+00:00 2026-05-29T22:28:51+00:00

I have a List of objects and a ListView where I display this list.

  • 0

I have a List of objects and a ListView where I display this list. Such an object has some properties, they are bound to the columns of the ListView.

<ListView x:Name="_fileNameList" FontSize="12" SourceUpdated="_fileNameList_SourceUpdated" TargetUpdated="_fileNameList_TargetUpdated">
    <ListView.View>
        <GridView x:Name="FileNameAttributes" >
            <GridViewColumn  Header="File Name"   Width="200" DisplayMemberBinding="{Binding fileName}"/>
            <GridViewColumn  Header="Size" Width="80" DisplayMemberBinding="{Binding size}"/>
            <GridViewColumn  Header="Date" Width="80" DisplayMemberBinding="{Binding date}"/>
            <GridViewColumn  Header="Time" Width="80" DisplayMemberBinding="{Binding time}"/>
            <GridViewColumn  Header="New Name" Width="300" DisplayMemberBinding="{Binding newFileName}"/>
        </GridView>
    </ListView.View>
</ListView>

This part is working fine.

Now I want to change the Foreground color of the newFileName column in a single row, but only if it is equal to the ‘fileName’ in the same row.

Can I do this in XAML or do I have to go to the code behind file?

I would like it best if I could handle it in XAML, because I think its a pure design issue, but I have no idea, where to start or where to put this, (can I do String comparisons in XAML?)

So I tried to handle this in the code behind file. I thought there must be an event that is raised when the ListView has changed, I tried the SourceUpdated event, but it is not entered when I change the content of my list.
The next problem would be, how to access those ListView items …

Can anyone give me an idea how I can solve this?

  • 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-29T22:28:52+00:00Added an answer on May 29, 2026 at 10:28 pm

    You can do this using MultiBinding and MultiConverter.
    You will need to write a MultiConverter which takes fileName and newFileName and returns true if they are equal

    <ListView x:Name="_fileNameList" FontSize="12" SourceUpdated="_fileNameList_SourceUpdated" TargetUpdated="_fileNameList_TargetUpdated">
                <ListView.View>
                    <GridView x:Name="FileNameAttributes" >
                        <GridViewColumn  Header="File Name"   Width="200" DisplayMemberBinding="{Binding fileName}"/>
                        <GridViewColumn  Header="Size" Width="80" DisplayMemberBinding="{Binding size}"/>
                        <GridViewColumn  Header="Date" Width="80" DisplayMemberBinding="{Binding date}"/>
                        <GridViewColumn  Header="Time" Width="80" DisplayMemberBinding="{Binding time}"/>
                        <GridViewColumn  Header="New Name" Width="300">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding newFileName}">
                                        <TextBlock.Style>
                                            <Style>
                                                <Setter Property="TextBlock.Foreground" Value="Black"></Setter>
                                                <Style.Triggers>
                                                     <DataTrigger Value="True">
                                                         <DataTrigger.Binding>
                                                             <MultiBinding Converter="{StaticResource EqualityConverter}">
                                                                 <Binding Path="newFileName"></Binding>
                                                                 <Binding Path="fileName"></Binding>
                                                             </MultiBinding>
                                                         </DataTrigger.Binding>
                                            <Setter Property="TextBlock.Foreground" Value="Red"></Setter>
                                        </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBlock.Style>
                                    </TextBlock>
    
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>
    

    The code for EqualityConverter is as below :

    public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
            {
                if (values[0].ToString().Equals(values[1].ToString()))
                    return true;
                return false;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a List collection of my objects. I need to display this collection
In have a list of objects bound to a ListView that is used to
I have a listview that is loaded with a list of objects that contain
I have List objects which are shown like this: www.mysite.com/lists/123 Where 123 is the
I have List where myObj has it own list of objects called example mySubObj.
I have a list of objects that have two int properties. The list is
I have a list of objects, some of which can be null. I want
I have a list of objects and I need to find an object as
I have a listview, which displays a list of administrators, this list is held
I have an asp:ListView control which list playlists. It has paging supported and holds

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.