Giter VIP home page Giter VIP logo

eventbinder's Introduction

Sergey's github stats

eventbinder's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar oshelton avatar serg046 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eventbinder's Issues

[Duplicate #59][Dumb question] How can I use it ?

It's said in getting started:

Just install the nuget package. If it does not work and you get XamlParseException, then apply [assembly: EventBinder.AssemblyReference] attribute in your AssemblyInfo.cs.

Ok, I have the Exception, and, that's all. How can I add this assembly reference ? Maybe related to #59. If so, I will wait then.

Thanks.

Edited for more Info:

xmlns:e="using:EventBinder" works. But Exception at {e:EventBinding...}
'Could not load file or assembly 'Avalonia.Visuals, Version=0.9.12.0, Culture=neutral, PublicKeyToken=null'. Le fichier spécifié est introuvable.'
So it's a duplicate issue.

Avoid multiple bindings

There could be an issue with Avalonia
There could be an issue when we change a VM to another one

Issue with binding to the same event of different control types (Avalonia)

I'm running into an issue when binding to the same event of different controls. I am binding to the Initialized event of multiple controls. When I do so, I get a System.MissingMethodException 'Constructor on type' with a long hex code.

<Image Initialized="{e:EventBinding Test}" ... />
<Button Initialized="{e:EventBindingn Test}" .../>

This error is repeated with any Event type that I've tried. (Initialize, AttachedToVisualTree, PointerPressed)

If the controls are all of the same type or if I bind to a different event for each different control, I do not have this issue. It only occurs when binding to the same event of different control types.

Support for Avalonia v11-preview

Hi, it would be nice if you could add support for v11-preview in a preview nuget package, it would only require a version change of Avalonia to a v11-preview. It does need a new build because there is a binary breaking change from pre v11 to v11.

Internal Compiler Error: Could not load Avalonia.Visuals, Version = 0.9.0.0

I recently upgraded my project from Avalonia version 0.10.13 to version 11.1.1. With this change any AXAML page that uses event binder throws the following error where it is trying to reference Avalonia.Visuals v 0.9.0.0.

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error		One or more errors occurred. (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 45, position 5.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 45, position 52.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 45, position 90.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 64, position 5.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 64, position 52.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 64, position 90.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 94, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 94, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 94, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 119, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 119, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 119, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 159, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 159, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 159, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 171, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 171, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 171, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 183, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 183, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 183, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 195, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 195, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 195, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 207, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 207, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 207, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 219, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 219, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 219, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 233, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 233, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 233, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 246, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 246, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 246, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 259, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 259, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 259, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 271, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 271, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 271, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 284, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 284, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 284, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 294, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 294, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 294, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 304, position 6.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 304, position 53.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 304, position 91.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 318, position 4.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 318, position 51.) (Internal compiler error: Could not load file or assembly 'Avalonia.Visuals, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. (AvaloniaXamlIlOptionMarkupExtensionTransformer) Line 318, position 89.)	ProjectName	C:\PATH_TO_AXAMLS\FILENAME.axaml			

In the solution explorer the package throws no errors or warnings.
eventBinderErrorPackages

Has anyone seen this issue before or have ideas on what I can check?

Actions Completed:

  • Removed all nugget packages and re-installed them
    • I work in an offline environment so I just download all of the packages required via nuget.exe
  • Ran dotnet restore on the solution
  • Problem isolated to only appear when AXAML page has event binding

EventBinder fails on KeyDown event in WPF - .NET 5.0

Hi @Serg046, thanks for a great tool! I run into an Exception when trying to bind to the KeyDown event (and many other events) in my .NET 5 wpf app. See image for the location in the code where it fails in EventBinding.cs (I changed the code slightly for simpler display of nullvalue) :

image

The event TextChanged or MouseLeftButtonDown works fine. Here's my xaml:

image

Any idea on how to fix, or if I'm doing something wrong?

Support implicit conversion from value types to reference types

The following code crashes because value types should be boxed before passing:

var button = XamlReader.Parse<Button>($"<Button Height=\"{expected}\" Name=\"Btn\" Click=\"{{e:EventBinding Invoke, {{Binding ElementName=Btn, Path=Height}}}}\"/>");
button.DataContext = new Action<object>(n => num = (double)n);

Remove unnecessary boxing

Rewrite the following method so that it will be generic without boxings

internal static object ResolveBinding(Binding binding, FrameworkElement source, int position)
{
	if (!BindingOperations.IsDataBound(source, _properties[position]))
	{
		BindingOperations.SetBinding(source, _properties[position], binding);
	}
	return source.GetValue(_properties[position]);
}

Support implicit conversion for number types

public void M() {
    int a = 6;
    Test(a, "");
}
    
public void Test(double x, string y) {}

The construction above compiles to this

        IL_0000: ldc.i4.6
        IL_0001: stloc.0
        IL_0002: ldarg.0
        IL_0003: ldloc.0
        IL_0004: conv.r8
        IL_0005: ldstr ""
        IL_000a: call instance void C::Test(float64, string)

Add support for such conversions

Improve handlers caching

Now the cache is based on type, method and arguments. It seems that caching based on type only is more efficient. Investigate this option (method and arguments can be passed at runtime).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.