2011-02-13 33 views

回答

14

最简单的方法是在ItemContainerStyle添加触发器为IsSelectedListBox

<ListBox ...> 
    <ListBox.ItemContainerStyle> 
     <Style TargetType="ListBoxItem"> 
      <Setter Property="BorderBrush" Value="Red"/> 
      <Style.Triggers> 
       <Trigger Property="IsSelected" Value="True"> 
        <Setter Property="BorderThickness" Value="1"/> 
       </Trigger> 
      </Style.Triggers> 
     </Style> 
    </ListBox.ItemContainerStyle> 
    <!--...--> 
</ListBox> 
+0

OMG它的工作,它是那么容易?!?! :D你摇滚M8! – syncis 2011-02-13 14:07:27