首页 > Windows开发 > 详细

wpf Button 动态改变效果

时间:2021-07-14 19:47:13      阅读:36      评论:0      收藏:0      [点我收藏+]

   <Button  x:Name="LearnMore"  Grid.Row="6"  HorizontalAlignment="Left" VerticalAlignment="Top" Click="go_webSite" >

                        <Button.Template>

                            <ControlTemplate TargetType="Button">

                                <Border Background="{TemplateBinding Button.Background}"  Cursor="Hand" CornerRadius="21" Height="42" Width="160">

                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

                                        <TextBlock  Height="25" VerticalAlignment="Center" Margin="0,4,0,0" Width="73" Foreground="#FFFFFF" FontSize="18"   TextAlignment="Center"  >了解更多</TextBlock>

                                        <Image Width="14" Margin="8,2,0,0" Height="12" Source="/Imgs/arrow.png" />

                                    </StackPanel>

                                </Border>

                                <ControlTemplate.Triggers>

                                    <Trigger  Property="Button.IsMouseOver"  Value="True">

                                        <Setter Property="Button.Background" Value="#0096D6" />

                                    </Trigger>

                                    <Trigger  Property="Button.IsMouseOver"  Value="false">

                                        <Setter Property="Button.Background" Value="#177BBF" />

                                    </Trigger>

                                    <Trigger  Property="Button.IsPressed"  Value="true">

                                        <Setter Property="Button.Background" Value="#2285C9" />

                                    </Trigger>

                                </ControlTemplate.Triggers>

                            </ControlTemplate>

                        </Button.Template>

                    </Button>

wpf Button 动态改变效果

原文:https://www.cnblogs.com/bruce1992/p/15012401.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!