0

Idk why I have this error:

enter image description here

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">

    <Window.Resources>
        <SolidColorBrush x:Key="MyBrush" Color="SkyBlue"/>
        <Style x:Key="MyButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="{StaticResource MyBrush}"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontSize" Value="16"/>
            <Setter Property="Padding" Value="10"/>
        </Style>
    </Window.Resources>


    <Grid>
        <Button Content="Click Me" Style="{StaticResource MyButtonStyle}" />
    </Grid>
</Window>

It's problem of visual studio? OR WHAT? I really don't understand this error? Why? Whats wrong. Please help me!

2
  • have you tried to play with code, remove some params or sections to localize problem ? Commented Sep 27, 2024 at 18:49
  • @SergShevchenko Yes, but it's not helped. Idk why but when I changed .NET 8 to .NET 9 all works! Commented Sep 28, 2024 at 7:09

1 Answer 1

0

Just change version of .NET from 8 to 9 and all works) IDK why...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.