Skip to content

Commit

Permalink
Fixed failure for dynamic binding when updates DataContext later than…
Browse files Browse the repository at this point in the history
… InitializeComponent() on Avalonia. #42
  • Loading branch information
kekyo committed May 15, 2024
1 parent f20897c commit 1c1432e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Epoxy.Core/EventBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,13 @@ static Event()
{
EventNameProperty.Changed.Subscribe(
new AnonymousObserver<AvaloniaPropertyChangedEventArgs<string>>(e =>
((Event)e.Sender).OnEventNamePropertyChanged(e.OldValue, e.NewValue)));
((Event)e.Sender).OnEventNamePropertyChanged(
e.OldValue.HasValue ? e.OldValue.Value : null,
e.NewValue.HasValue ? e.NewValue.Value : null)));
CommandProperty.Changed.Subscribe(
new AnonymousObserver<AvaloniaPropertyChangedEventArgs<ICommand>>(e =>
((Event)e.Sender).OnCommandPropertyChanged(e.NewValue)));
((Event)e.Sender).OnCommandPropertyChanged(
e.NewValue.HasValue ? e.NewValue.Value : null)));
}
#else
/// <summary>
Expand Down

0 comments on commit 1c1432e

Please sign in to comment.