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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:13:34+00:00 2026-06-01T15:13:34+00:00

I am creating a button style. Paste this into a window to see the

  • 0

I am creating a button style. Paste this into a window to see the idea:

<Style x:Key="SelectionButton3"
        TargetType="{x:Type Button}">

    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">

                <Grid HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        ClipToBounds="False">

                    <Grid.RowDefinitions>
                        <RowDefinition Height="75"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Border x:Name="TheBorder" 
                            BorderThickness="0,1.5,1.5,1.5"
                            CornerRadius="3"
                            Background="SteelBlue"
                            Height="35"
                            Grid.Column="1"
                            Grid.Row="0"
                            Margin="-31"
                            BorderBrush="DarkSlateBlue">

                        <Border.BitmapEffect>
                            <DropShadowBitmapEffect x:Name="BorderShadow" 
                                                    ShadowDepth="0"/>
                        </Border.BitmapEffect>

                    </Border>

                    <Rectangle Fill="SteelBlue"
                                Stroke="DarkSlateBlue"
                                Grid.Row="0"
                                Grid.Column="0">

                        <Rectangle.LayoutTransform>
                            <RotateTransform Angle="-45" />
                        </Rectangle.LayoutTransform>

                        <Rectangle.BitmapEffect>
                            <DropShadowBitmapEffect ShadowDepth="5"/>
                        </Rectangle.BitmapEffect>

                    </Rectangle>

                    <ContentPresenter x:Name="ContentArea"
                                        VerticalAlignment="Center"
                                        HorizontalAlignment="Center"
                                        Content="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}" />
                </Grid>

            </ControlTemplate>
        </Setter.Value>

    </Setter>

    <Setter Property="Foreground"
            Value="LightGray" />
    <Setter Property="FontFamily"
            Value="Segoe UI" />



</Style>

<Button Click="Button_Click"
        Style="{StaticResource SelectionButton3}"
        Width="185">

</Button>

What I would like to have happen is for the Borders drop shadow to appear when the mouse is over either the Border or the Rectangle. I know I need a trigger, but I’m not really sure where & how to do it.

Can someone point me in the right direction?

Thanks

  • 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-01T15:13:36+00:00Added an answer on June 1, 2026 at 3:13 pm
    <Style x:Key="SelectionButton3"
            TargetType="{x:Type Button}">
    
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
    
                    <Grid HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            ClipToBounds="False">
    
                        <Grid.RowDefinitions>
                            <RowDefinition Height="75"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
    
                        <Border x:Name="TheBorder" 
                                BorderThickness="0,1.5,1.5,1.5"
                                CornerRadius="3"
                                Background="SteelBlue"
                                Height="35"
                                Grid.Column="1"
                                Grid.Row="0"
                                Margin="-31"
                                BorderBrush="DarkSlateBlue">
                        </Border>
    
                        <Rectangle Name="rect" Fill="SteelBlue"
                                    Stroke="DarkSlateBlue"
                                    Grid.Row="0"
                                    Grid.Column="0">
    
                            <Rectangle.LayoutTransform>
                                <RotateTransform Angle="-45" />
                            </Rectangle.LayoutTransform>
    
                        </Rectangle>
    
                        <ContentPresenter x:Name="ContentArea"
                                            VerticalAlignment="Center"
                                            HorizontalAlignment="Center"
                                            Content="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                      <Trigger Property="IsMouseOver" Value="True">
                        <Setter TargetName="TheBorder" Property="BitmapEffect">
                          <Setter.Value>
                            <DropShadowBitmapEffect ShadowDepth="0" />
                          </Setter.Value>
                        </Setter>
                        <Setter TargetName="rect" Property="BitmapEffect">
                          <Setter.Value>
                            <DropShadowBitmapEffect ShadowDepth="5"/>
                          </Setter.Value>
                        </Setter>
                      </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
    
        </Setter>
    
        <Setter Property="Foreground"
                Value="LightGray" />
        <Setter Property="FontFamily"
                Value="Segoe UI" />
    
    
    
    </Style>
    

    Note that unless you’re using .NET 3.0 or 3.5 pre SP1, you should use Effect instead of BitmapEffect. The BitmapEffect property has been deprecated in 3.5 SP1

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

Sidebar

Related Questions

I'm creating a custom drawn window by specifying border style NONE and custom processing
In one of my projects I have used input[type=button] to apply a style to
This is my XAML makiing a Style where the Button looks like an Ellipse.
I am creating Cancel button with my own Background image this way: UIBarButtonItem *leftBarButton
Possible Duplicate: Creating a left-arrow button (like UINavigationBar's “back” style) on a UIToolbar I
I'm creating a style that targets a button. The buttons that the style will
I've seen several questions/answers related to entirely creating a button in code, but not
I've written some code for a button action. First I'm creating a button UI
I'm creating some 50 button dynamically. Text is getting set as followed: btn.Text=result.Rows[i]["Col1"].ToString()+"\n"+result.Rows[i]["Col2"].ToString() +"\n"+result.Rows[i]["Col3"].ToString();
I want to create a Button otherthan creating it from xml layout.i want to

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.