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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:00:48+00:00 2026-05-26T01:00:48+00:00

I want to make a button like this: The first image is a normal

  • 0

I want to make a button like this:
enter image description here

The first image is a normal button, but the second is a button with mouseEnter event fired. The bottom part of the button in the second image is not clickable and it acts like a tool tip. How can I make this kind of a button? Do I need to use a tool tip? Please give me some code examples.

EDIT:

Here’s F Ruffel’s code which I modified:

<HeaderedContentControl BorderBrush="Black">
                <HeaderedContentControl.Header>
                    <TextBlock Text="Header Placeholder" Margin="5" />
                </HeaderedContentControl.Header>
                <StackPanel>
                    <TextBlock Text="Content Placeholder Line 1" Margin="5" HorizontalAlignment="Center"/>
                    <TextBlock Text="Content Placeholder Line 2" Margin="5" HorizontalAlignment="Center"/>
                    <TextBlock Text="Content Placeholder Line 3" Margin="5" HorizontalAlignment="Center"/>
                </StackPanel>

                <HeaderedContentControl.Style>
                    <Style TargetType="{x:Type HeaderedContentControl}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition />
                                            <RowDefinition />
                                        </Grid.RowDefinitions>
                                        <Border x:Name="headerBorder" Grid.Row="0" Grid.Column="0" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}">
                                            <Grid Name="Header">
                                                <Rectangle Fill="White"/>
                                                <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Header}"/>
                                            </Grid>
                                        </Border>
                                        <Border x:Name="contentBorder" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Visibility="Collapsed">
                                            <ContentPresenter />
                                        </Border>
                                        <Border x:Name="cutOutBorder" Grid.Row="0" Grid.Column="1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,1" Visibility="Collapsed" />
                                    </Grid>
                                    <ControlTemplate.Triggers>
                                        <Trigger SourceName="Header" Property="IsMouseOver" Value="True">
                                            <Setter TargetName="headerBorder" Property="BorderThickness" Value="1,1,1,0" />
                                            <Setter TargetName="contentBorder" Property="BorderThickness" Value="1,0,1,1" />
                                            <Setter TargetName="contentBorder" Property="Visibility" Value="Visible" />
                                            <Setter TargetName="cutOutBorder" Property="Visibility" Value="Visible" />
                                        </Trigger>                                      
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </HeaderedContentControl.Style>

            </HeaderedContentControl>
    </StackPanel>

Now the last problem is: the expanded part pushes all controls down, and that’s what I don’t want. Please modify this code to make the extended part overlay controls that are below it, just like in the image.

  • 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-26T01:00:48+00:00Added an answer on May 26, 2026 at 1:00 am

    What I like about WPF is that there is a hundred and one ways to do the same thing. In addition to the suggestions above, you could easily style a HeaderedContentControl to give the desired look and behaviour:

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
        <StackPanel>
            <HeaderedContentControl BorderBrush="Black">
                <HeaderedContentControl.Header>
                    <TextBlock Text="Header Placeholder" Margin="5" />
                </HeaderedContentControl.Header>
                <StackPanel>
                    <TextBlock Text="Content Placeholder Line 1" Margin="5" HorizontalAlignment="Center"/>
                    <TextBlock Text="Content Placeholder Line 2" Margin="5" HorizontalAlignment="Center"/>
                    <TextBlock Text="Content Placeholder Line 3" Margin="5" HorizontalAlignment="Center"/>
                </StackPanel>
                <HeaderedContentControl.Style>
                    <Style TargetType="{x:Type HeaderedContentControl}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
                                    <Grid x:Name="outerGrid" Background="Transparent">
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition />
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition />
                                                <RowDefinition />
                                            </Grid.RowDefinitions>
                                            <Border x:Name="headerBorder" Grid.Row="0" Grid.Column="0" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}">
                                                <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Header}"/>
                                            </Border>
                                            <Border x:Name="contentBorder" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Visibility="Collapsed">
                                                <ContentPresenter />
                                            </Border>
                                            <Border x:Name="cutOutBorder" Grid.Row="0" Grid.Column="1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,1" Visibility="Collapsed" Background="Transparent" />
                                        </Grid>
                                    </Grid>
                                    <ControlTemplate.Triggers>
                                        <EventTrigger RoutedEvent="UIElement.MouseLeftButtonUp" SourceName="contentPresenter">
                                            <BeginStoryboard x:Name="makeVisibleBeginStoryboard">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="headerBorder" Storyboard.TargetProperty="BorderThickness">
                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <Thickness Left="1" Top="1" Right="1" Bottom="0" />
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="contentBorder" Storyboard.TargetProperty="BorderThickness">
                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <Thickness Left="1" Top="0" Right="1" Bottom="1" />
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="contentBorder" Storyboard.TargetProperty="Visibility">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="cutOutBorder" Storyboard.TargetProperty="Visibility">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                        <EventTrigger RoutedEvent="UIElement.MouseLeave" SourceName="outerGrid">
                                            <StopStoryboard BeginStoryboardName="makeVisibleBeginStoryboard" />
                                        </EventTrigger>
                                        <EventTrigger RoutedEvent="UIElement.MouseEnter" SourceName="cutOutBorder">
                                            <StopStoryboard BeginStoryboardName="makeVisibleBeginStoryboard" />
                                        </EventTrigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </HeaderedContentControl.Style>
            </HeaderedContentControl>
        </StackPanel>
    </Window>
    

    This solution simulates a cut-out portion (which is just a cell in a Grid). It uses an EventTrigger so that content is visible when the Header is clicked, and content is made invisible when the mouse leaves the Grid hosting the content, or if it enters the cut-out portion.

    Although I think this achieves what you are after, I would recommend investigating other approaches like ToolTip, Adorner, or a even custom control. Using animations like this always feels like over-kill to me 🙂

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

Sidebar

Related Questions

I want to make a C++ button on Start>Run i.e but when I do
READ FIRST I re-wrote this to make it more readable. If you want to
I want to make a Jquery form, having form structure like this panel1{ Name
I want to make a button that starts my php script after I click
I want to make preview button as usual form button next to submit button(as
I am writing an iPhone programer, and I want to make a button with
My goal here is to make a button. I want the text to sit
I have the following markup, and I want to make the All radio button
I want to, when the user clicks a button on my website, to make
I've got some Buttons that I want to make un-clickable (but still appear on

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.