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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:17:26+00:00 2026-06-01T10:17:26+00:00

I have a list view as following: <ListView x:Name=lvLedger Height={Binding Path=GridHight, ElementName=ledgerList} Width={Binding Path=GridWidth,

  • 0

I have a list view as following:

<ListView x:Name="lvLedger" 
              Height="{Binding Path=GridHight, ElementName=ledgerList}" 
              Width="{Binding Path=GridWidth, ElementName=ledgerList}" 
              ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
              ScrollViewer.VerticalScrollBarVisibility="Auto" 
              ItemsSource="{Binding}" 
              BorderThickness="0" 
              Background="Transparent" 
              BorderBrush="Transparent" 
              DataContextChanged="lvLedger_DataContextChanged">
        <ListView.View>
            <GridView>
                <GridViewColumn x:Name="c2ServiceDate" Header="Service Date" Width="82" >
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=servicedate}"  
                                ToolTipService.ShowDuration="60000" 
                                ToolTipService.InitialShowDelay="0" 
                                ToolTip="{Binding Path=type}" />
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
                <GridViewColumn x:Name="c3CPT" Header="Code" Width="50">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=cpt}"  
                                ToolTipService.ShowDuration="60000" 
                                ToolTipService.InitialShowDelay="0" 
                                ToolTip="{Binding Path=type}" />
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
        <!--More columns here-->        </GridViewColumn></GridView></ListView.View></ListView>

What i would like to be able to do is change the background color of the the row based on the combination of Service Date and Code. So i may have 3 lines in a row with the same service date and code which should have the same background followed by 2 lines with a different color and then alternate based on the same rule

1/19/11 356 (blue)
1/19/11 356 (blue)
1/19/11 235 (red)
2/20/11 356 (blue)
2/20/11 356 (blue)
2/20/11 356 (blue)
2/21/11 564 (red)
2/21/11 564 (red)
2/21/11 564 (red)
2/21/11 564 (red)
2/25/11 798 (blue)
and soo on…

ItemSource is being bounded to a DataView from an external control.

I really have no idea how i could do something like that and any help would be appriciated.

  • 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-06-01T10:17:28+00:00Added an answer on June 1, 2026 at 10:17 am

    How about adding a ColorProperty to the class/model that your row(line) is bound to. Then there you already have dates and numbers there. Once you set them, set the color as well, now without converters, you can just trigger on that property:

    <Style x:Key="ListViewItemStyle" TargetType="ListViewItem">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Border x:Name="Border" SnapsToDevicePixels="true">
                            <GridViewRowPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                            <Border.Style>
                                <Style TargetType="Border">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding ColorProperty}" Value="Blue">
                                            <Setter Property="Background" Value="Blue"/>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding ColorProperty}" Value="Red">
                                            <Setter Property="Background" Value="Red"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following ListView : <ListView Name=TrackListView> <ListView.View> <GridView> <GridViewColumn Header=Title Width=100 HeaderTemplate={StaticResource
I have the following GridView : <ListView Name=TrackListView ItemContainerStyle={StaticResource itemstyle}> <ListView.View> <GridView> <GridViewColumn Header=Title
I have the following code in xaml: <ListView Name=listView1 IsSynchronizedWithCurrentItem=True > <ListView.View> <GridView> <GridViewColumn
I have a listview with following column <GridViewColumn Header=name local:GridViewSort.PropertyName=Name> <GridViewColumn.CellTemplate> <DataTemplate> <TextBox Text={Binding
Helo. I have the following requirement: I have a list (ListView or Spinner depends
In my XML, I have the following <ListView android:id=@android:id/list android:layout_width=match_parent android:layout_height=fill_parent > </ListView> How
I have defined in XAML a list view, see following fragment: <Grid> <Button Content=_Generate
I have the following view <ul data-role=listview data-inset=true> <!-- ko with: model.Item_selected --> <li
I have the following model class (simplified) class A{ private String name; private List<B>
I have the following ListView in which I am using the JQuery UI sortable

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.