2009-06-11 80 views

回答

1

當然,我們可以使用ItemsControl.ItemContainerStyle上一個ItemsControl或任何導出的控制來設置風格所含的元素。

<Style x:Key="customStyle"> 
    <Setter Property="Control.Opacity" 
      Value=".5" /> 
    <Style.Triggers> 
     <Trigger Property="Control.IsMouseOver" 
       Value="True"> 
      <Setter Property="Control.Opacity" 
        Value="1" /> 
     </Trigger> 
    </Style.Triggers> 
</Style> 

<ItemsControl ItemContainerStyle="{StaticResource customStyle}"> 
    <ListBoxItem >Item 1</ListBoxItem> 
    <sys:String>Automaticly gets Wrapped</sys:String> 
    <ListBoxItem>Item 3</ListBoxItem> 
</ItemsControl> 
相關問題