【WPF】Listbox内item的样式替换默认选中样式和鼠标滑过样式


 1     <Style TargetType="ListBoxItem" x:Key="oiliu">
 2         <!-- 设置控件模板 -->
 3         <Setter Property="Template">
 4             <Setter.Value>
 5                 <ControlTemplate TargetType="ListBoxItem">
 6                     <Border Background="{TemplateBinding Background}" Padding="0" Margin="4,0,0,0">
 7                         <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
 8                                               VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
 9                                               TextBlock.Foreground="{TemplateBinding Foreground}"/>
10                     </Border>
11                 </ControlTemplate>
12             </Setter.Value>
13         </Setter>
14     </Style>

TargetType


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM