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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:11:29+00:00 2026-06-09T05:11:29+00:00

How can I strike through all textblocks inside my WPF listview? Right now I’ve

  • 0

How can I strike through all textblocks inside my WPF listview? Right now I’ve defined a style that I have to apply to each textblock. It looks like this

    <Style x:Key="orderDetailsTextBlock" TargetType="TextBlock" >
        <Style.Triggers>
            <DataTrigger Binding="{Binding Status}" Value="Failed">
                <Setter Property="TextDecorations" Value="Strikethrough" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

What I want is to be able to apply this once inside the ListViewItem Style block.

I tried to do it like this

    <Style x:Key="ordersListViewItemStyle" TargetType="{x:Type ListViewItem}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding Status}" Value="Failed">
                <Setter Property="TextBlock.TextDecorations" Value="Strikethrough" />
            </DataTrigger>
        </Style.Triggers>           
    </Style>

But this doesn’t work. Any help will appreciated.

Update
I updated the ListView’s XAML as follows

    <ListView x:Name="orderDetails" AlternationCount="2" ItemContainerStyle="{StaticResource ordersListViewItemStyle}" >
    <ListView.Resources>
        <Style TargetType="TextBlock">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Status}" Value="Failed">
                    <Setter Property="TextDecorations" Value="Strikethrough" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </ListView.Resources>
    <ListView.View>
        <GridView>
            <GridViewColumn Width="100" Header="Статус" >
                <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock 
                                            Text="{Binding Path=Status, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                                            ToolTip="{Binding Path=Message, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                                            TextAlignment="Center" />
                    </DataTemplate>
                </GridViewColumn.CellTemplate>
            </GridViewColumn>
        </GridView>
    </ListView.View>
</ListView>

Nothing happens. What have I done wrong?

  • 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-09T05:11:31+00:00Added an answer on June 9, 2026 at 5:11 am

    You can define the Style inside your ListView.Resources without a Key, and it’s scope will be restricted to all TextBlocks inside that particular ListView.

    For instance:

    <ListView x:Name="MyListView">
        <ListView.Resources>
            <Style TargetType="TextBlock">
                <!-- Style specific content -->
            </Style>
        </ListView.Resources>
        <!-- ListView content -->
    </ListView>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the code that you can see below in order to strike through
How can I use strike-through font in objective C??? More specifically in UITableViewCell cell.textLabel.text
Can I order my users in the database, so I don't have to say
I have a common base class from which all my ASMX webservice classes will
I have a series of shapes that I want the user to be able
I have the understanding that using data access routines directly from presentation code is
I have a drawing application in Android that allows the user to draw with
I have a Prawn PDF that prints off a list of tickets in a
Where can I find a free WYSIWYG component that offers at least the basic
I'm working through the design of a Django inventory tracking application, and have hit

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.