Search code examples
c#.netmvvmavaloniaui

PropertyChangedNotifier for Avalonia?


PropertyChangedNotifier is a basic function that is often needed in WPF to know when a DependencyProperty changed, as implemented here.

Has anyone converted or written a similar function for Avalonia UI, or is there a built-in feature to do the job?

I'm trying to convert the code but it's relatively complex and converting it would require extensive testing.


Solution

  • listBoxItem.GetObservable(ListBoxItem.IsSelectedProperty)
        .Subscribe(e => 
    {
       // your handler code
    });
    

    Or just consume the observable via Reactive Extensions instead of just subscribing a handler.