I think the best way to do such things is to use converters, so you don't need to foul the view with styles that handle it, and the logic is not in the view
something like that
IsEnabled="{Binding ElementName=cboVersion, Path=SelectedItem, Converter={StaticResource ObjectToBoolConverter}}"
of course you need ObjectToBool coverage, something like this (very simple without type checks etc ... and should be improved)
public class ObjectToBoolConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return value != null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); }
}
and do not forget to register the converter in your resource for example.
<Converters:ObjectToBoolConverter x:Key="ObjectToBoolConverter"/>
source share