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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:30:39+00:00 2026-05-18T05:30:39+00:00

I have a problem that is driving me mad, and I just dont seem

  • 0

I have a problem that is driving me mad, and I just dont seem to be able to find a solution.

I have a Listview, for which the listivew ItemTemplate is a Datatemplate that looks like this:

<DataTemplate x:Key="template" >
  <TextBlock  Foreground="Green"  >
    <Hyperlink   Command="{Binding LoadReportCommand}"
              CommandParameter="{Binding DisplayName}"  >
            <TextBlock  Text="{Binding DisplayName}"  />
    </Hyperlink>       
   </TextBlock>
</DataTemplate>

The style for the hyperlink is as follows:

<Style x:Key="{x:Type Hyperlink}" TargetType="{x:Type Hyperlink}">
    <Setter Property="Foreground" Value="Green" />
    <Style.Triggers>
        <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding RelativeSource={RelativeSource   FindAncestor, AncestorType={x:Type ListViewItem}}, Path=IsSelected}" Value="True" />
            <Condition Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}, Path=Selector.IsSelectionActive}" Value="True" />
            </MultiDataTrigger.Conditions>
            <Setter Property="Foreground" Value="White"/>
        </MultiDataTrigger>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
        </Trigger>
    </Style.Triggers>
</Style>

When I use it as is it does not turn the foreground white as would be expected when the item is selected. It does turn the foreground gray if the command is not enabled as is expected. If I remove the condition for Selector.IsSelectionActive it does turn the foreground white when the item is selection, but it is also white if the item is selected but not active…. I want the Inactive selection to be green. I have tried this also with just a plane Textblock, a button with a very basic style… nothing seems to work.

The listview is in a usercontrol that is used in another user control. The Datatemplate is in the resourcedictionary of the second user control, and bound to a dependency property of the first user control of type DataTemplate, and the style for the hyperlink is in a separate Resourcedictionary.

Any Help will be much appreciated

  • 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-18T05:30:40+00:00Added an answer on May 18, 2026 at 5:30 am

    Hmm Selector.IsSelectionActive is that false when the control hasn’t got focus? If so maybe you could use an ancestorbinding on the listview and check for focus?

    Now that I look at it – you are binding to an attached property – there is a slight changed syntax for that – try Path=(Selector.IsSelectionActive)} instead.

    Green links – odd 🙂

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

Sidebar

Related Questions

I have a little problem that's driving me mad. I have the following example
I have a problem which has been driving me mad for days - I've
Jade template inheritance in Jade is driving me mad... The problem is that I
This problem has been driving me mad. Here's the general gist: I have two
I have this problem that is driving me insane. I have a project to
I have a simple yet hard problem here that is driving me nuts ...
I have a problem with an ASP.NET application that is driving me nuts. When
Hey! Have a problem that is driving me crazy! My Main Window will not
this problem is driving me really mad. In an Asp.Net-application, I have two DropDownLists,
I have a problem that is driving me nuts. Matlab sees only some of

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.