I have the following data trigger on the ListBoxItems in my Multi-selection ListBox
It seems that once the "IsSelected" property is set, whether by user or in code behind, the setter will no longer work. I'm not sure if there is any way around that, but there is at least a hack that would work in your specific case. You could register a handler for the "IsEnabledChanged" event on your ListBoxItem and then check your data condition and set IsSelected in the handler if the data calls for it.
Example:
private void ListBoxItem_EnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
ListBoxItem senderItem = (ListBoxItem)sender;
if (YourDataCondition == true)
{
senderItem.IsSelected = false;
}
}
The only other solution I've been able to find would be to add some dependency property to your ListBoxItem, register a similar method to its "OnPropertyChanged" event, and change that property in your DataTrigger.
Here is someone else's attempt to do this that I haven't been able to verify yet.