目前我有这个视觉:
我想要一个与我的边框相匹配的悬停效果,并且在项目之间有一个空间。
<ListBox Grid.Column="1" Grid.Row="0" Margin="5,0,0,0" Grid.RowSpan="2" ItemsSource="{Binding Programme.Versions, UpdateSourceTrigger=PropertyChanged}" MouseLeftButtonUp="ChangerVersion_MouseLeftButtonUp" Style="{StaticResource NoBorder}">
<!--<ListBox.ItemsPanel>
<ItemsPanelTemplate >
<WrapPanel IsItemsHost="True" Orientation="Vertical" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel> -->
<ListBox.ItemContainerStyle >
<Style TargetType="ListBoxItem">
<!--<Setter Property="Margin" Value="0,0,0,2"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>-->
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate DataType="bOs:VersionBO" >
<Border Padding="0" BorderThickness="1" BorderBrush="{DynamicResource Accent}" >
<Grid Cursor="Hand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="7"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Rectangle Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Fill="{DynamicResource Accent}" />
<TextBlock Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Background="{DynamicResource Accent}" Foreground="White" Margin="5" FontSize="18">
<TextBlock.Text>
<MultiBinding StringFormat="{}V{0}.{1}">
<Binding Path="Numero" />
<Binding Path="NumeroModification" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<TextBlock Text="{Binding Description}" Grid.Column="2" Grid.Row="0" />
<Image Grid.Column="2" Grid.Row="0" Width="20" Margin="0,2,2,0" Visibility="{Binding Interdit, Converter={StaticResource BooleanToVisibilityConverter}}" Source="../Images/Icones/interdit.png" HorizontalAlignment="Right" />
<TextBlock Grid.Column="2" Grid.Row="1">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource MultiValuesWithSeparatorConverter}">
<Binding Path="Langue.Libelle" />
<Binding Path="SousTitre" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
当我重新定义 时ItemContainerStyle
,我失去了悬停效果。