© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
14 replies
yotabit

Style dependent on a property

A Button
ConfirmationButton
ConfirmationButton
should have the
Style= MahApps.Styles.Button.Dialogs.Accent
Style= MahApps.Styles.Button.Dialogs.Accent
when the boolean property
CancellationVisible
CancellationVisible
that I'm binding is
True
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.
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>
<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>
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Change WPF element style depending on property value
C#CC# / help
17mo ago
❔ Access a DB property from a not mapped property
C#CC# / help
3y ago
❔ Issue with a Property
C#CC# / help
3y ago