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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:10:52+00:00 2026-05-12T11:10:52+00:00

In order to apply a triggered animation to all ToolTip s in my app,

  • 0

In order to apply a triggered animation to all ToolTips in my app, I’m using a ControlTemplate. However, when using a ControlTemplate the ToolTip loses all of its default visual properties as defined, I believe, by the theme. How can I retain all properties except for those that I override?

Using the following code

<ToolTip Opacity="0.8">
  <ToolTip.Content>
    <StackPanel>
      <Label FontWeight="Bold" Background="DarkSlateBlue" Foreground="White">
        WpfApplication1
      </Label>
      <Label>
        Click to create another button
      </Label>
    </StackPanel>
  </ToolTip.Content>
</ToolTip>

I get the result I want:

alt text http://img29.imageshack.us/img29/1488/controltemplateno.png

But when I adjust the code to use a ControlTemplate as so:

<ControlTemplate x:Key="controltemplateToolTip" TargetType="{x:Type ToolTip}">
  <ContentPresenter Content="{TemplateBinding Content}" />  
  <ControlTemplate.Triggers>
    <EventTrigger RoutedEvent="ToolTip.Loaded">
      <BeginStoryboard>
        <Storyboard TargetProperty="Opacity">
          <DoubleAnimation From="0" To="0.8" Duration="0:0:0.2" />
        </Storyboard>
      </BeginStoryboard>
    </EventTrigger>
  </ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="{x:Type ToolTip}">
  <Setter Property="Template" Value="{StaticResource controltemplateToolTip}" />
</Style>
...
<ToolTip>
  <ToolTip.Content>
    <StackPanel>
      <Label FontWeight="Bold" Background="DarkSlateBlue" Foreground="White">
        WpfApplication1
      </Label>
      <Label>
        Click to create another button
      </Label>
    </StackPanel>
  </ToolTip.Content>
</ToolTip>

I get the following:

alt text http://img43.imageshack.us/img43/8217/controltemplateyes.png

As you can see, the theme default border, background, etc. are not maintained. I don’t want to set these explicitly as I want them to adjust according to the user’s theme. How can I remedy this? Am I going about this the wrong way?

  • 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-12T11:10:52+00:00Added an answer on May 12, 2026 at 11:10 am

    You can’t inherit ControlTemplate from theme style. But you don’t have to. Use DataTemplates to achieve what you want. Here is a quick example:

    <Page
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
      <Page.Resources>
      <Style TargetType="{x:Type ToolTip}">
      <Style.Triggers>
        <EventTrigger RoutedEvent="ToolTip.Loaded">
          <BeginStoryboard>
            <Storyboard TargetProperty="Opacity">
              <DoubleAnimation From="0" To="0.8" Duration="0:0:0.5" />
            </Storyboard>
          </BeginStoryboard>
        </EventTrigger>
      </Style.Triggers>
      </Style>
    
    <DataTemplate x:Key="ToolTipContentTemplate">
    <StackPanel>
          <Label FontWeight="Bold" Background="DarkSlateBlue" Foreground="White">
            WpfApplication1
          </Label>
          <Label>
            Click to create another button
          </Label>
        </StackPanel>
    </DataTemplate>
      </Page.Resources>
    
      <Grid>  
    <Button Content="Hello">
    <Button.ToolTip>
    <ToolTip ContentTemplate="{StaticResource ToolTipContentTemplate}">
      <ToolTip.Content>
        Doesn't matter in this case
      </ToolTip.Content>
    </ToolTip>
    </Button.ToolTip>
    </Button>
      </Grid>
    </Page>
    

    You can paste it to Kaxaml, and test it.

    Hope this helps.

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

Sidebar

Related Questions

In Perl 5, we can apply functional programming techniques (using closures, higher order functions
I am investigating the use of the boost graph libraries in order to apply
How do I apply a parameter to a select and order attribute in a
I'm searching for a way to apply the so called alphanumeric order for standard
Order deny,allow deny from all allow from xx.xx.x.xx RewriteRule . - [F] I have
I'm attempting to apply Ayende's order search from here to an existing index. The
I am looking to use the shape functionality in WPF in order to apply
Is there a way to apply a custom order to the Select A View
hi Please tell me how to apply multiple valued sort order in solr here
Here graph is higher-order function that returns a function with config set in its

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.