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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:09:51+00:00 2026-05-23T15:09:51+00:00

I have stack panel containing three textblocks bounded with different member variable.I want to

  • 0

I have stack panel containing three textblocks bounded with different member variable.I

want to set a property on textblocks foreground based on Is mouse over property. can i use

the same is mouse over property for all textblocks of the panel or i have to set for each

and every textblock? This is the first time i’m using triggers.

Here is my code

 <StackPanel Grid.ColumnSpan="3" HorizontalAlignment="Left" Orientation="Horizontal" Margin="0,-3,0,2.932">
         <TextBlock Grid.Column="0" Text="{Binding Path=Location}" Foreground="#FFFFF1A5" Style="{StaticResource Textstyle}" />
         <TextBlock Grid.Column="1" Text="{Binding Path=Name}" Foreground="#FFFFF1A5" Style="{StaticResource Textstyle}" />
         <TextBlock Grid.Column="2" Text="{Binding Path=Age}"Foreground="#FFFFF1A5" Style="{StaticResource Textstyle}" />
                  <StackPanel.Resources>
                     <Style x:Key="Textstyle" TargetType="{x:Type TextBlock}">
                          <Style.Triggers>
                             <Trigger Property="IsMouseOver" Value="True">
                                 <Setter Property="Foreground" Value="#FFFFFFFF"/>                                                                                                       
                             </Trigger>
                           </Style.Triggers>
                     </Style>                                               
                  </StackPanel.Resources>
  </StackPanel>

Is there anything wrong in my approach?

Because im not getting any result from this.Please answer my question.please

  • 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-23T15:09:51+00:00Added an answer on May 23, 2026 at 3:09 pm

    Your local Foreground property is overriding the Style. Set the default Foreground property in the style instead.

    <StackPanel Grid.ColumnSpan="3" HorizontalAlignment="Left" Orientation="Horizontal" Margin="0,-3,0,2.932">
        <StackPanel.Resources>
            <Style x:Key="Textstyle" TargetType="TextBlock">
                <Setter Property="Foreground" Value="#FFFFF1A5"/>
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Foreground" Value="#FFFFFFFF"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </StackPanel.Resources>
        <TextBlock Grid.Column="0" Text="{Binding Path=Location}" Style="{StaticResource Textstyle}" />
        <TextBlock Grid.Column="1" Text="{Binding Path=Name}" Style="{StaticResource Textstyle}" />
        <TextBlock Grid.Column="2" Text="{Binding Path=Age}" Style="{StaticResource Textstyle}" />
    </StackPanel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stack panel inside of an expander panel that I programaticaly adds
[Situation] I have a custom item control which I add to a stack panel
Now I have a stack of free time on my hands, I wanna get
I have read on Stack Overflow some people that have converting to C#2.0 to
So I have a nasty stack overflow I have been trying to track down
Does anyone know if the problems that have been affecting Stack Overflow with regards
In my WPF application, I have a Stackpanel containing several controls inside them. How
In WPF 3.5 (with SP1), I have simply StackPanel that I would like to
I have a ListBox with a StackPanel that contains an image and label. <ListBox.ItemsPanel>
I have a combo box with the following DataTemplate: <DataTemplate x:Key=ComboBoxDataTemplate> <StackPanel> <TextBlock Text={Binding

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.