2009-06-11 5 views

Répondre

1

Bien sûr, nous pouvons utiliser la ItemsControl.ItemContainerStyle sur un ItemsControl ou tout contrôle dérivé pour définir un style pour les éléments contenus.

<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> 
Questions connexes