-1

I am develop a new app for Windows 11 with WinUi 3 and in my MainPage the button appears all black in dark theme:

Why this happen?

This is a resume of my code:

<Window
    <Grid Name="Main" RowDefinitions="Auto,*">
        <RelativePanel Grid.Row="0"
                       Background="{ThemeResource SystemControlAcrylicWindowBrush}">
            <TextBlock Name="TextBlock_AAA"
                       Text="AAA">
        </RelativePanel>
        <RelativePanel Grid.Row="1">
            <Button Name="Button_AAA"
                Content="AAA"
                Click="AAA_Click"/>
        </RelativePanel>
    </Grid>
</Window>
Luís
  • 157
  • 2
  • 10

1 Answers1

0

@Luís, you're putting your UI directly in your window which is why it is not being styled. Add a Blank Page (from the WinUI tab in VisualStudio) called something like "MainPage" and move your Grid into the XAML for the Page. In the XAML for your main window, simply put <local:MainPage/> as the only content. Now your button will look like the one in the comment by @nico-zhu-msft

EddieLotter
  • 324
  • 3
  • 8