question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Click property is not implemented

See original GitHub issue

My program crash when you try to use the Click property in a Button:

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> OmniXaml.LoadException: Error loading XAML: OmniXaml.ParseException: Cannot find a property named "Click" in the type Avalonia.Controls.Button

XAML file:

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="AvaloniaAppTemplate">
	<StackPanel HorizontalAlignment="Center">
		<Button Click="OnClick" Content="Hola"></Button>
	</StackPanel>
</Window>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
BlackDragonBEcommented, Mar 21, 2018

I’m still getting errors in the XAML designer when I try to use the Button Click property with version 0.6.1.

Here’s the XAML:

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MarkdownToRWGUI">

  <StackPanel Orientation="Vertical" HorizontalAlignment="Center" MaxWidth="400" Width="300">
    <TextBlock Text="{Binding Greeting}"></TextBlock>
    <TextBox Text="{Binding Name}"></TextBox>
    <Button Content="Click me!" Click="OnButtonClicked"></Button> 
    <TextBlock Text="{Binding Result}"></TextBlock>
  </StackPanel>
</Window>

Here’s the event:

        public void OnButtonClicked(object sender, RoutedEventArgs args)
        {
            var context = DataContext as HelloViewModel;
            context.Result = "Hi " + context.Name + " !";
        }

The designer crashes and shows me this:

Portable.Xaml.XamlObjectWriterException: Could not convert object 'OnButtonClicked' (of type System.String) to {clr-namespace:System;assembly=mscorlib}EventHandler({clr-namespace:Avalonia.Interactivity;assembly=Avalonia.Interactivity}RoutedEventArgs): Referenced value method OnButtonClicked in type Avalonia.Controls.Window indicated by event System.EventHandler`1[[Avalonia.Interactivity.RoutedEventArgs, Avalonia.Interactivity, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null]] was not found ---> Portable.Xaml.XamlObjectWriterException: Referenced value method OnButtonClicked in type Avalonia.Controls.Window indicated by event System.EventHandler`1[[Avalonia.Interactivity.RoutedEventArgs, Avalonia.Interactivity, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null]] was not found
   at Portable.Xaml.ComponentModel.EventConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)

The weird thing is that it actually works if I run the app, but it’s super annoying that I can’t use the designer preview anymore now. Any solution?

0reactions
jkoritzinskycommented, May 29, 2018

Yeah it falls into that. It can be done on its own though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you indicate a inherited property is not implemented?
There really is no nice way to not implement something :( Someone somewhere is going to get upset if they expect it and...
Read more >
Why "Click Text" not working in Firefox & Chrome browser? ...
I have use “Click Text” to search text on web page and click text it work well on IE but not work in...
Read more >
Click() method not working and Console returns an error ...
getElementsByClassName returns an array of elements, not a single element. In order to avoid the error, you need to access a single element...
Read more >
Element: click event - Web APIs | MDN
The MouseEvent object passed into the event handler for click has its detail property set to the number of times the target was...
Read more >
Error message when you click the Columns tab in OLE DB ...
Describes a problem that occurs when you click the Columns tab in OLE DB Source ... If the property is not implemented, an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found