2009-06-11 89 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> 
相关问题