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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:10:50+00:00 2026-05-31T21:10:50+00:00

I have made a custom suface button according this example: <Button> <Button.Template> <ControlTemplate TargetType=Button>

  • 0

I have made a custom suface button according this example:

<Button>
    <Button.Template>
        <ControlTemplate TargetType="Button">
            <Grid>
                <!-- my custom shape -->
                                    <Polygon
                                     Points="400,150 100,350 100,350, 500,350"
                                     Stroke="Purple" 
                                     StrokeThickness="2"
                                     Name="L1">
                                       <Polygon.Fill>
                                          <SolidColorBrush Color="Blue" Opacity="0.4"/>
                                       </Polygon.Fill>
                    </Polygon>
                <ContentPresenter />
            </Grid>
        </ControlTemplate>
    </Button.Template>
</Button>

But there is a problem with styles – there is no behaviour when touched/holded/released. Could you give me a clue how to do that?

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-05-31T21:10:51+00:00Added an answer on May 31, 2026 at 9:10 pm

    An example control template (found at msdn) is:

    <Style TargetType="Button">
      <Setter Property="SnapsToDevicePixels" Value="true"/>
      <Setter Property="OverridesDefaultStyle" Value="true"/>
      <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
      <Setter Property="MinHeight" Value="23"/>
      <Setter Property="MinWidth" Value="75"/>
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="Button">
            <Border 
              x:Name="Border"  
              CornerRadius="2" 
              BorderThickness="1"
              Background="{StaticResource NormalBrush}"
              BorderBrush="{StaticResource NormalBorderBrush}">
              <ContentPresenter 
                Margin="2"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                RecognizesAccessKey="True"/>
            </Border>
            <ControlTemplate.Triggers>
              <Trigger Property="IsKeyboardFocused" Value="true">
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DefaultedBorderBrush}" />
              </Trigger>
              <Trigger Property="IsDefaulted" Value="true">
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DefaultedBorderBrush}" />
              </Trigger>
              <Trigger Property="IsMouseOver" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource DarkBrush}" />
              </Trigger>
              <Trigger Property="IsPressed" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PressedBorderBrush}" />
              </Trigger>
              <Trigger Property="IsEnabled" Value="false">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
    

    As you can see you stripped out all the triggers, not to mention visual styles.

    I would take that code and put your polygon in place of the ContentPresenter.

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

Sidebar

Related Questions

Coming from this question , I have a wxComboCtrl with a custom popup made
I have made a Custom Component in XML, consisting of a button with an
I have made a custom control for windows phone 7. If I use this
I have made a custom button bar as described here . Now, I want
I have made a custom UISwitch (from this post) . But the problem is,
I have made a custom button based on an image by more or less
I have made a custom UserControl i Vb.net (windows application). How can I add
I have made a custom formwizard and incorporated it into my admin interface. Basically
Here's what I have: Custom-made C# CMS where the content is stored in a
I have a custom-made view that extends the View class. I would like 2

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.