Why am I getting a "Unable to find suitable setter or adder" error when defining a LinearGradientBrush in my <UserControl.Resources>?
See original GitHub issueHi:
I’m running into issues defining a LinearGradientBrush in my <UserControl.Resources> in my UserControl.
Here is the XAML Definition:
<UserControl x:Class="SampleViews.SplashView"
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:views="clr-namespace:SampleViews"
mc:Ignorable="d" >
<UserControl.Resources>
<LinearGradientBrush x:Key="LGB1" EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="#3F000000" Offset="0"/>
<GradientStop Offset="1"/>
</LinearGradientBrush>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".2*" />
<ColumnDefinition Width=".6*" MinWidth="300"/>
<ColumnDefinition Width=".2*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="{StaticResource LGB1}"></Border>
</Grid>
</UserControl>
Here is the error message:
Error XAMLIL Unable to find suitable setter or adder for property Resources of type Avalonia.Styling:Avalonia.StyledElement for argument Avalonia.Visuals:Avalonia.Media.LinearGradientBrush, available setter parameter lists are: Avalonia.Controls.IResourceDictionary System.Collections.Generic.KeyValuePair`2<System.Object,System.Object>
I should be able to define this resource within the UserControl.Resources to be used throughout the page, correct?
Am I doing something wrong here?
Thanks, JohnB
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Issue with applying style on WPF UserControl
When you use an UserControl, it means that you already know its layout, and there is no need to style the control further....
Read more >GradientStop Class - Typedescriptor
Why am I getting a "Unable to find suitable setter or adder" error when defining a LinearGradientBrush in my <UserControl.Resources>? #3554.
Read more >LinearGradientBrush Class - Typedescriptor
Why am I getting a "Unable to find suitable setter or adder" error when defining a LinearGradientBrush in my <UserControl.Resources>? #3554.
Read more >LinearGradientBrush Class (Windows.UI.Xaml.Media)
Paints an area with a linear gradient. ... The XAML syntax shown for Brush types is appropriate for defining the brush as a...
Read more >the of and to a in for is on s that by this with i you it not
the of and to a in for is on s that by this with i you it not or be are from ......
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 is you wrote
x:key
but it’sx:Key
.I have the same problem:
error: