WPF Shaped Button – Visaul Studio/Blend

You need to create a ControlTemplate for the Button. This can be done both in Blend and Visual Studio. I did it in VS2015.
Here is your code:

But, for the future, try to do some work yourself before posting the question. Include just enough code to allow others to reproduce the problem. For help with this, read How to create a Minimal, Complete, and Verifiable example.

<Grid Background="Red">
    <Button Height="52" Opacity="0.8">
            <Style TargetType="Button">
                <Setter Property="Background">
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
                            <GradientStop Color="#053755" Offset="0" />
                            <GradientStop Color="#053755" Offset="0.5" />
                            <GradientStop Color="#061F31" Offset="0.5" />
                            <GradientStop Color="#061F31" Offset="1.0" />
                <Setter Property="Template">
                        <ControlTemplate TargetType="Button">
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                <Border Margin="-1,0" Grid.Column="1" Background="{TemplateBinding Background}"  BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,1">
                                    <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"/>
                                <Path Fill="{TemplateBinding Background}" Data="M13,0 0,25 0,27 13,52 13,52" Stroke="{TemplateBinding BorderBrush}" Width="13" Stretch="Fill" ClipToBounds="True"/>
                                <Path Grid.Column="2" Data="M0,0 13,25 13,27 0,52" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" Width="13" Stretch="Fill" ClipToBounds="True"/>

Browse More Popular Posts

Leave a Comment