Skip to content

Xaml style setter doesn't work #10788

Answered by jeromelaban
n2-holden asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to change styles you have to options, the first with implicit styles (without x:Name or x:Key), the second with explicit style (with an x:Name or x:Key). You can have more details in Microsoft's WinUI documentation about styles.

Here sample you can experiment with: https://playground.platform.uno/#9c23d023

<ContentControl>
    <FrameworkElement.Resources>
        <Style TargetType="AppBarButton">
            <Setter Property="Foreground" Value="Orange" />
        </Style>
        <Style TargetType="AppBarButton" x:Key="OtherStyle">
            <Setter Property="Foreground" Value="Red" />
        </Style>
    </FrameworkElement.Resources>

    <StackPanel>
        <AppBarButton I…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jeromelaban
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants