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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:15:46+00:00 2026-06-15T13:15:46+00:00

I have the following problem: I have a Button , which has a StackPanel

  • 0

I have the following problem: I have a Button, which has a StackPanel inside it, with a ContentControl and a Label within the StackPanel, and I’ve set the button’s properties IsMouseOver and IsPressed to change the button’s colour when the action happen. But, I would like to invert the label’s colour when the mouse is over the button.

This is my button’s code: (because I think my description is not clear enough):

<Button Template="{StaticResource OnMouseOver}" ToolTip="Release" >
    <StackPanel Orientation="Horizontal">
        <ContentControl Template="{StaticResource Release}"/>
        <Label Content="Release" Foreground="#457345" />
    </StackPanel>
</Button>

This is how I changed the button’s properties when the button is pressed and when the mouse is over the button:

<ControlTemplate TargetType="Button" x:Key="OnMouseOver">
    <Border x:Name="border" Background="Transparent">
        <ContentPresenter ContentSource="Content" />
    </Border>
    <ControlTemplate.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter TargetName="border" Property="Background" Value="#A1CCA1"/>
        </Trigger>
        <Trigger Property="IsPressed" Value="True">
            <Setter TargetName="border" Property="Background" Value="#AFD8AF"/>
        </Trigger>
    </ControlTemplate.Triggers>
</ControlTemplate>

For the record, I’ve tried to do something like ControlTemplate for my label, but it didn’t work, and my label just vanished when I did.

Could you help me?

  • 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-15T13:15:46+00:00Added an answer on June 15, 2026 at 1:15 pm

    try this :

        <ControlTemplate TargetType="Button" x:Key="OnMouseOver">
    <Border x:Name="border" Background="Transparent">       
        <StackPanel Orientation="Horizontal">
                <ContentControl />
                <Label x:Name="label" Content="Release" Foreground="#457345" />
            </StackPanel>
    </Border>
    <ControlTemplate.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter TargetName="border" Property="Background" Value="#A1CCA1"/> 
             <Setter TargetName="label" Property="Foreground" Value="#AFD8AF"/>     
        </Trigger>
        <Trigger Property="IsPressed" Value="True">
            <Setter TargetName="border" Property="Background" Value="#AFD8AF"/>
             <Setter TargetName="label" Property="Foreground" Value="#A1CCA1"/> 
        </Trigger>
    </ControlTemplate.Triggers>
    

    <Button x:Name="button" Template="{StaticResource OnMouseOver}" ToolTip="Release" Height="42" VerticalAlignment="Bottom" Margin="235,0,127,143" >
    
        </Button>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

if have the following problem: I have a List which i am going through
I have a ProgressBarWindow which has a progressbar and a cancel button on it
I have created a simple application which has a red background and a button
I have a table which has a button to Add Rows. This button adds
I need to have a single <li> element which has two buttons inside of
I have created an applet which has a necessity to execute the following code:
I have the following problem. I have a small form with a button (we're
My situation : I have a problem with an ASP.NET button, which does not
I have a launching Activity A1 which has a start button which starts a
I have an aspx page which has the following: A repeater with a linkbutton

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.