我是 WPF 新手。我在 WPF 的列表视图中有一个复选框列表。我有功能,当用户单击复选框时,它会突出显示该行。一切正常。但是,当复选框被禁用时,它仍然会突出显示该行并且它还会检查复选框。我如何使它不突出显示或检查用户何时单击禁用的复选框?提前致谢。
<ListView ScrollViewer.ScrollChanged="lstRewardsExpiration_ScrollChanged" Height="178" HorizontalAlignment="Left" Margin="12,0,0,81" Name="lstRewardsEarned" VerticalAlignment="Bottom" Width="327" SelectionMode="Multiple" Background="White" FontFamily="Calibri" FontSize="16">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="IsSelected" Value="{Binding Path=IsChecked, Mode=TwoWay}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="Border" SnapsToDevicePixels="true">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="Cyan"/>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter TargetName="Border" Property="Background" Value="Transparent"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
</ListView>