When trying to have multiple styles the Program throws exception
See original GitHub issueDescribe the bug When I have multiple styles inside <Window.Styles> Avalonia throws and exception
To Reproduce
<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"
xmlns:gif="clr-namespace:AvaloniaGif;assembly=AvaloniaGif"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
MinWidth="800" MinHeight="450"
Width="800" Height="450"
x:Class="AnimationTest.MainWindow"
Title="AnimationTest">
<Window.Styles>
<Style Selector="Image#intro">
<Setter Property="Width" Value="5"/>
<Setter Property="Height" Value="5"/>
<Style.Animations>
<Animation Delay="0:0:1" Duration="0:0:2">
<KeyFrame Cue="0%">
<Setter Property="Width" Value="800"/>
<Setter Property="Height" Value="450"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Height" Value="5"/>
<Setter Property="Width" Value="5"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
<Style Selector="Grid#grd_test">
<Style.Animations>
<Animation Delay="0:0:1" Duration="0:0:2">
<KeyFrame Cue="0%">
<Setter Property="Opacity" Value="0.0"/>
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Opacity" Value="1.0"/>
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</Window.Styles>
<Grid Name="grd_intro" MinWidth="1">
<Image Name="intro" Grid.Column="1"
Stretch="UniformToFill"
gif:GifImage.SourceUriRaw="resm:AnimationTest.Assets.intro.gif" gif:GifImage.IterationCount="0"/>
</Grid>
<Grid Name="grd_test">
</Grid>
</Window>
Exception XAMLIL Unable to find a setter that allows multiple assignments to the property Content of type Avalonia.Controls:Avalonia.Controls.ContentControl Line 1, position 2. AnimationTest C:\Users\user\source\repos\AnimationTest\AnimationTest\MainWindow.axaml
Desktop (please complete the following information):
- OS: Windows 10
- Version Avalonia v0.10.0, .NET 5
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
In Java, is using throws Exception instead of ...
No, absolutely not. You should specify what exceptions you're going to throw so the caller can do the right thing with each one....
Read more >Why shouldn't a method throw multiple types of checked ...
Declaring a method to throw too many differently rooted exceptions makes exception handling onerous and leads to poor programming practices such ...
Read more >Best Practices for exceptions - .NET
Learn best practices for exceptions, such as using try/catch/finally, handling common conditions without exceptions, and using predefined .
Read more >Types of Exceptions in Java
Learn about the different types of exceptions in Java (checked and unchecked) and see specific examples.
Read more >How to Throw Exceptions in Java
When exceptions are thrown, they may be caught by the application code. The exception class extends Throwable . The constructor contains two ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think the problem here is that the
Window
has 2 children, as stated by the error.@jp2masa Thank you so much, that was actually the issue, I totally forgot that I have 2 grids in the MainWindow. I was way too focused on the <Style Selector="######"> part…