C#C
C#4y ago
yotabit

Style dependent on a property

A Button ConfirmationButton should have the Style= MahApps.Styles.Button.Dialogs.Accent when the boolean property CancellationVisible that I'm binding is True.

The code below shows how I tried to do it, but the problem is that it shows this error:
error MC3029: 'Style' member is not valid because it does not have a qualifying type name.

How can I fix it or achieve the same behavior?

<Button x:Name="ConfirmationButton" >
     <Button.Triggers>
          <DataTrigger Binding="{Binding CancellationVisible}" Value="True">
                        <Setter Property="Style" Value="{StaticResource MahApps.Styles.Button.Dialogs.Accent}" />
          </DataTrigger>
      </Button.Triggers>
</Button>
Was this page helpful?