I have a multi-trigger for my IsEnabled and IsChecked property. It is working well except that after the checkbox is disabled, it will not re-enable with code. Here is the XAML:
<ListViewScrollViewer.ScrollChanged="lstRewardsEarned_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><StyleTargetType="{x:Type ListViewItem}"><!-- bind content IsSelected to the ListViewItem IsChecked --><Setter Property="IsSelected" Value="{Binding Path=IsChecked, Mode=TwoWay, UpdateSourceTrigger=Explicit}"/><!-- bind content IsEnabled to the ListViewItem IsEnabled --><Setter Property="IsEnabled" Value="{Binding Path=IsEnabled, Mode=TwoWay, UpdateSourceTrigger=Explicit}"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="ListBoxItem"><Border x:Name="Border" SnapsToDevicePixels="true"><ContentPresenter /></Border><ControlTemplate.Triggers><!--Highlight if IsSelected and IsEnabled--><MultiTrigger><MultiTrigger.Conditions><Condition Property="IsSelected" Value="True"/><Condition Property="IsEnabled" Value="True"/></MultiTrigger.Conditions><MultiTrigger.Setters><Setter TargetName="Border" Property="Background" Value="Cyan"/></MultiTrigger.Setters></MultiTrigger><!--Remove highlight if is not Selected and IsEnabled--><MultiTrigger><MultiTrigger.Conditions><Condition Property="IsSelected" Value="False"/><Condition Property="IsEnabled" Value="True"/></MultiTrigger.Conditions><MultiTrigger.Setters><Setter TargetName="Border" Property="Background" Value="Transparent"/></MultiTrigger.Setters></MultiTrigger><!--Add a trigger to remove the highlighting if IsEnabled is changed to false--><Trigger Property="IsEnabled" Value="False"><Setter TargetName="Border" Property="Background" Value="Transparent"/></Trigger></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter></Style></ListView.ItemContainerStyle></ListView>
This is the code to re-enable the checkboxes:
ForEach checkBox AsCheckBoxIn lstRewardsEarned.Items
checkBox.IsEnabled=true'This writes out false!
Console.WriteLine(checkBox.IsEnabled)
Next
Thanks in advance.