Unable to find suitable setter or adder for property Click
See original GitHub issueI’m unable to set “Click” event for Button in XAML. Adding “Click” attribute in XAML throws error during compilation (no matter if method exist or not in cs file): “Avalonia error XAMLIL: Unable to find suitable setter or adder for property Click of type Avalonia.Controls:Avalonia.Controls.Button for argument System.Runtime:System.String, available setter parameter lists are:”
Here is MainWindow.xaml:
<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"
x:Class="MMHelper.MainWindow"
Title="MMHelper">
<Button Click="testClick" Content="Test" />
</Window>
I’ve looked into issues and found similar issue but I seems it was fixed. I’m using .Net Core 3.1 on Arch Linux, Avalonia version is 0.9.2.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Button will not work, unable to find suitable setter or getter
'Unable to find suitable setter or adder for property Click of type Avalonia.Controls:Avalonia.Controls.Button for argument Avalonia.
Read more >Unable to find a setter that allows multiple assignments to the ...
Unable to find a setter that allows multiple assignments to the property Content of type Avalonia.Controls:Avalonia.Controls.ContentControl.
Read more >XAMLIL: Unable to find suitable setter or adder for property ...
Hello! Recently, I update Avalonia on my project to nightly build (now preview build Avalonia 0.9.0-preview3) and some problems has appeared ...
Read more >RoutedEventArgs Class - Typedescriptor
On This Page. Constructors; Properties; Assemblies; Issues ... Unable to find suitable setter or adder for property Click of type Avalonia.Controls #3898.
Read more >Binding to Commands
Controls that carry out an action, such as Button have a Command property which can be bound to an ICommand . When the...
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

Hi. I have similar problem. I am trying to add event SelectionChanged to drop box, but I get this error. Also getting same error with PointerPressed event in data grid, but LoadingRow works. So theese are events from documentation. Am I missing something? I’m using Avalonia 0.10.14 on Windows and .NET6.
<ComboBox Name="ComboBox" Width="100" Height="28" Margin="15,21,0,0" Items="{Binding SerialCards}" SelectedItem="{Binding Path=SelectedCard, Mode=TwoWay}" SelectionChanged="_DropDownClosed"/><DataGrid MaxHeight="300" Name="InvoicesGrid" Items="{Binding SdcImportedInvoices}" AutoGenerateColumns="False" LoadingRow="dataGrid_LoadingRows" IsReadOnly="True" PointerPressed="_OnRowClick">Hello… I had similar problem, also, and I resolved it on a way that I’m used propper parameter in a given event method. For example, if we want use GotFocus we can use method such as:
If we want use LostFocus we can use it such as:
If we want use TextInput event we can use it such as:
Where Handler, Handler2 and Handler3 are names of given event from xaml. You can see documentation, for example for textbox control: http://reference.avaloniaui.net/api/Avalonia.Controls/TextBox/