WPF Inline style not setting template values

Viewed 2530

I have some base button styles that i want to inheritand make some minor changes, but not in the main style. I extracted the main problem to a new application with minimal xaml. The only thing i want to accomplish is change the button height when the button is disabled.

The two triggers are what i have tried , neither seem to work or give any debug messages about unable to find what its binding to.

<Button HorizontalAlignment="Center"
    Height="90"
    Margin="5"
    Click="Button_Click"
    VerticalAlignment="Bottom">
    <Button.Style>
        <Style TargetType="Button">
            <Style.Triggers>
                <Trigger Property="Button.IsEnabled"
                         Value="False">
                    <Setter Property="Button.Height"
                            Value="50" />
                </Trigger>
                <DataTrigger Binding="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}}"
                             Value="False">
                    <Setter Property="Button.Height"
                            Value="50" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Button.Style>
    Foo Bar
</Button>

The button click

private void Button_Click(object sender, RoutedEventArgs e)
{
    (sender as FrameworkElement).IsEnabled = false;
}

Thanks for reading.

1 Answers
Related