【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