C#C
C#2y ago
rallez

Avalonia UI Unable to find suitable setter or adder for property Styles

Hey im starting with Avlonia UI. (BTW give your thought sif should I go for it or something else?). My really simple program doesn't comiple for reason:
Error AVLN:0004 Avalonia: Unable to find suitable setter or adder for property Styles of type Avalonia.Base:Avalonia.StyledElement for argument System.Runtime:System.Object, available setter parameter lists are:
Avalonia.Styling.IStyle
Avalonia.Styling.IStyle Line 23, position 57.


<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        Width="400"
        Height="600"
        CanResize="False"
        WindowStartupLocation="CenterScreen"
        WindowState="Normal"
        Background="#0D1B2A"
        x:Class="Calculator.MainWindow"
        Title="Calculator"
        ExtendClientAreaToDecorationsHint="True"
        ExtendClientAreaTitleBarHeightHint="-1"
        ExtendClientAreaChromeHints="NoChrome"
        PointerPressed="DragMove">
    
    <Grid ShowGridLines="True" RowDefinitions="1.5*,3*,15*">

        <Grid Grid.Row="0" ColumnDefinitions="*, Auto, 50">
            <TextBlock Grid.Column="0" Text="Calculator" />
            <Button Grid.Column="2" Click="CloseWindow" Styles="{StaticResource CloseButtonStyle}"/>


        </Grid>

        <Grid Grid.Row="1" />

        <Grid Grid.Row="2" />

    </Grid>

</Window>

<Styles xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Design.PreviewWith>
        <Border Padding="20">
        </Border>
    </Design.PreviewWith>

    <Style x:Key="CloseButtonStyle" Selector="Button">
        <Setter Property="Background" Value="#E6E8E6"/>
    </Style>

</Styles>
Was this page helpful?