【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>

TargetTypespa

相關文章
相關標籤/搜索