<ListBox>
<!-- 数据 -->
<ListBoxItem>AAAA</ListBoxItem>
<ListBoxItem>BB</ListBoxItem>
<ListBoxItem>CCCC</ListBoxItem> <!-- 设置ListBoxItem样式 -->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<!-- 设置控件模板 -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
TextBlock.Foreground="{TemplateBinding Foreground}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter> <!-- 设置触发器 -->
<Style.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" Value="LightPink"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="LightGreen"/>
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>

最新文章

  1. python学习笔记-python程序运行
  2. 【BZOJ】2563: 阿狸和桃子的游戏
  3. sencha动态向容器里添加控件出现重叠问题
  4. Struts2(二)---将页面表单中的数据提交给Action
  5. 笔记:PHP查询mysql数据后中文字符乱码
  6. python基础:三元运算
  7. Solr与Mysql简单集成
  8. DISCUZ! X2.5设置仅允许QQ登录注册论坛 加固会员注册机制
  9. 28个MongoDB NoSQL数据库的面试问答
  10. c# 哈希表集合;函数
  11. HTML5 canvas图像绘制方法与像素操作属性和方法
  12. qplot函数用法(转载)
  13. python之socket模块
  14. 【开源】 bsf.mvc spingboot的扩展
  15. 一个label两种颜色,一个label两种字体
  16. 开始一个django项目的流程
  17. PHP5.5+Nginx1.9
  18. libnids关于计算校验和引起的抓不到包的现象的解决方法
  19. 在 arc里面打印 引用计数的方法
  20. [LeetCode&amp;Python] Problem 561. Array Partition I

热门文章

  1. Linux Swap故障之 swapoff failed: Cannot allocate memory
  2. out文件 dev c++
  3. php怎么识别真实ip
  4. Ubuntu 18.04 环境下安装 Matlab2018
  5. nginx访问url内容过滤
  6. reflow和repaint理解总结
  7. day002-Linux基础之常用基本命令讲解
  8. haproxy 2.0 dataplaneapi rest api 几个方便的问题排查接口
  9. javascript冒泡排序 至少比较N(N-1)/2次;
  10. 全部文章&gt; Maven