Declare a binding for IsEnabled property with converter,
<Style x:Key="btnStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource BaseBtnStyle}">
<Setter Property="UIElement.IsEnabled" Value="False" />
<Setter Property="Margin" Value="3,2"/>
<Setter Property="Template" Value="{DynamicResource GrayButtonTemplate}"/>
<Setter Property="IsEnabled" Value="{Binding Converter={StaticResource myconverter}}"/>
</Style>
Since we didn't specify the path for the Binding, entire data context object will pass through the converter. Based on several conditions, you can return true or false, that will enable or disable the button.
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var foo = (foo) value;
return (foo.num == 1 || foo.num == 2) && foo.str == "aaa";
}