Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avalonia11 Events Binding invalid #42

Closed
cbuduknui opened this issue May 11, 2024 · 5 comments
Closed

Avalonia11 Events Binding invalid #42

cbuduknui opened this issue May 11, 2024 · 5 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@cbuduknui
Copy link

Avalonia version : 11.0.10
Epoxy.Avalonia11 : 1.13.0

ep:EventBinder.Events
<ep:Event Command="{Binding ViewLoaded}" EventName="Loaded" />
</ep:EventBinder.Events>

public string Greeting { get; set; } = "Welcome to Avalonia!";
public Command ViewLoaded { get; }

public MainViewModel()
{
this.ViewLoaded = Command.Factory.Create(() =>
{
Greeting = "Hello!";
return default;
});
}

ViewLoaded command not invoke.

@kekyo kekyo added the question Further information is requested label May 12, 2024
@kekyo
Copy link
Owner

kekyo commented May 12, 2024

Hmm, I don't know what outer control the MainViewModel is bound to, could it be Opened instead of Loaded?

The sample code below is using Epoxy on Avalonia11 and it works as intended:

https://github.com/kekyo/FlashCap/blob/227cca10f66e504cf3abb690fb15fe854da16825/samples/FlashCap.Avalonia/FlashCap.Avalonia.UI/Views/MainWindow.axaml#L21

    <epoxy:EventBinder.Events>
        <epoxy:Event EventName="Opened" Command="{Binding Opened}" />
    </epoxy:EventBinder.Events>
        // Window shown:
        this.Opened = Command.Factory.Create(() =>
        {
            // ...
        }

@cbuduknui
Copy link
Author

cbuduknui commented May 13, 2024

I am using C# language and TargetFramework is .net 8
in Window Control using Opened event.
in Usercontrol using Loaded event.
above both event command not invoke.
epoxy:EventBinder.Events
<epoxy:Event EventName="Opened" Command="{Binding ViewLoaded }" />
</epoxy:EventBinder.Events>

@kekyo
Copy link
Owner

kekyo commented May 15, 2024

Thanks, I reproduced your problem and will analyze it, please wait!

https://github.com/kekyo/Epoxy.Avalonia11.SampleProject

@kekyo kekyo added the bug Something isn't working label May 15, 2024
@kekyo kekyo self-assigned this May 15, 2024
kekyo added a commit that referenced this issue May 15, 2024
@kekyo
Copy link
Owner

kekyo commented May 15, 2024

Being deployed 1.14.0 contains bug fix, could you please test it?

@cbuduknui
Copy link
Author

Version 1.14.0 is test ok!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants