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

  • Home
  • SEARCH
  • 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 6362367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:53:57+00:00 2026-05-24T23:53:57+00:00

A relative n00b to WPF. I have a ListView thus: <ListView> <ListView.View> <GridView> …

  • 0

A relative n00b to WPF. I have a ListView thus:

<ListView>
    <ListView.View>
        <GridView>
            ...
        </GridView>
    </ListView.View>
    <ListView.Resources>
        <Style TargetType="{x:Type ListViewItem}">
            <EventSetter Event="MouseDoubleClick" Handler="ItemDoubleClick"/>
        </Style>
    </ListView.Resources>
</ListView>

And in my app.xaml I have the following styles:

<Style TargetType="{x:Type ListView}">
    <Setter Property="ItemContainerStyle" Value="{DynamicResource ListViewItemStyle}"/>
</Style>
<Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ListViewItem">
                <Border x:Name="Border" Padding="4">
                    <GridViewRowPresenter x:Name="ItemText" 
                                          TextBlock.FontSize="14" TextBlock.Foreground="{x:Static SystemColors.ControlDarkDarkBrush}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                </Border>

                <ControlTemplate.Triggers>
                    <MultiTrigger>
                        <MultiTrigger.Conditions>
                            <Condition Property="IsMouseOver" Value="True"/>
                            <Condition Property="IsSelected" Value="False"/>
                        </MultiTrigger.Conditions>

                        <Setter TargetName="ItemText" Property="TextBlock.Foreground" Value="{x:Static SystemColors.WindowTextBrush}"/>
                    </MultiTrigger>

                    <Trigger Property="IsSelected" Value="True">
                        <Setter TargetName="Border" Property="Background" Value="{x:Static SystemColors.HighlightBrush}"/>
                        <Setter TargetName="ItemText" Property="TextBlock.Foreground" Value="{x:Static SystemColors.HighlightTextBrush}"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

But once I’m setting the ItemContainerStyle, the double-click no longer fires. If I remove it, it fires but my ListViewItems are not styled.

What am I missing here?

  • 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-24T23:53:58+00:00Added an answer on May 24, 2026 at 11:53 pm

    Your local resource is overridden by the application resources style which changes the ListView’s ItemContainerStyle property. I would suggest setting the style directly on the ListView.ItemContainerStyle and basing the style on the existing one:

    <ListView.ItemContainerStyle>
        <Style TargetType="{x:Type ListViewItem}"
               BasedOn="{StaticResource {x:Type ListViewItem}}">
            <EventSetter Event="MouseDoubleClick" Handler="ItemDoubleClick"/>
        </Style>
    </ListView.ItemContainerStyle>
    

    (This assumes implicit styling, so either remove the key of the style in your application resources or reference it directly using that key in the BasedOn property)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got relative layout in my view hierarchy and I want it to have
Whar are the relative merits between GDI+ and WPF? Also does anyone know the
I have a relative path (e.g. foo/bar/baz/quux.xml) and I want to pop a directory
Questions - (Relative Code Below) I have a custom class which is a BindableDictionary().
I have developed Relative layout for 3.7 droids with Relative layout and difficult relations
I have a image (relative URL=/images/image.jpg) , how to get a file object of
i have one main relative layout in that i have buttons and in middle
Multilevel relative import I have following folder structure top\ __init__.py util\ __init__.py utiltest.py foo\
I am a relative beginner at git - I have two branches: master and
I'm using a Relative layout as the root or parent container and I have

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.