Link button in wpf
来源:互联网 发布:达芬奇视频调色软件 编辑:程序博客网 时间:2024/05/21 18:42
1.引自:http://stackoverflow.com/questions/780426/link-button-in-wpf
If you don't want any of the normal Button style and just want something that looks like a hyperlink you could start with this
<Button Margin="5" Content="Test" Cursor="Hand"> <Button.Template> <ControlTemplate TargetType="Button"> <TextBlock TextDecorations="Underline"> <ContentPresenter /> </TextBlock> </ControlTemplate> </Button.Template> <Button.Style> <Style TargetType="Button"> <Setter Property="Foreground" Value="Blue" /> <Style.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Foreground" Value="Red" /> </Trigger> </Style.Triggers> </Style> </Button.Style></Button>
Here's the same as a style:
<Style x:Key="LinkButton" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <TextBlock TextDecorations="Underline"> <ContentPresenter /></TextBlock> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="Foreground" Value="Blue" /> <Style.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Foreground" Value="Red" /> </Trigger> </Style.Triggers></Style>
and you can use it like this:
<Button Style="{StaticResource LinkButton}" Content="Clicky" />
2.引自:http://www.cnblogs.com/fwbnet/archive/2012/05/09/2493452.html
<Button Margin="5" Content="Test" Cursor="Hand"><Button.Template><ControlTemplate TargetType="Button"><TextBlock TextDecorations="Underline"><ContentPresenter /></TextBlock></ControlTemplate></Button.Template><Button.Style><Style TargetType="Button"><Setter Property="Foreground" Value="Blue" /><Style.Triggers><Trigger Property="IsMouseOver" Value="true"><Setter Property="Foreground" Value="Red" /></Trigger></Style.Triggers></Style></Button.Style></Button>
0 0
- Link button in wpf
- ControlTemplate in WPF —— Button
- wpf link
- WPF BUTTON
- [WPF] WPF的按钮(Button)
- wpf学习笔记---Button
- wpf button ,datagrid style
- Wpf Button样式例子
- BUTTON WPF 样式
- 透明BUTTON 模板 WPF
- wpf button 样式模版
- wpf button style
- WPF Silverlight Button样式
- WPF Button Color Style
- WPF 美化Button按钮
- Wpf Button自定义样式
- Wpf Button Style customized
- WPF之Button
- 接口java.io.Serializable的用处 (全面搜集总结)
- 可以把PDF分割的软件
- 解决mysql"Access denied for user'root'@'IP地址'"问题
- 二叉树的层次遍历(从上到下和从下到上两种)
- git使用记录
- Link button in wpf
- 如何安装VM虚拟机,解决注册表写入问题。
- 高斯金字塔,拉普拉斯金字塔图像的缩放
- 透明背景的制作
- NOJ 1012 进制转换(十进制转换成任意进制)
- Android使用RecyclerView替代ListView(一)
- Geolocation
- 信息化建设工作计划
- Linux ALSA 音频设备