2019-10-30 19:39:12 +00:00
|
|
|
|
using ReactiveUI;
|
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Reactive.Disposables;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
2020-01-11 06:43:40 +00:00
|
|
|
|
public class UserControlRx<TViewModel> : ReactiveUserControl<TViewModel>, IReactiveObject
|
|
|
|
|
where TViewModel : class
|
|
|
|
|
{
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
public event PropertyChangingEventHandler PropertyChanging;
|
|
|
|
|
|
|
|
|
|
public void RaisePropertyChanging(PropertyChangingEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
PropertyChanging?.Invoke(this, args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RaisePropertyChanged(PropertyChangedEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
PropertyChanged?.Invoke(this, args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected static void WireNotifyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
|
|
|
{
|
2020-01-17 00:28:52 +00:00
|
|
|
|
if (!(d is UserControlRx<TViewModel> control)) return;
|
2020-01-11 06:43:40 +00:00
|
|
|
|
if (Equals(e.OldValue, e.NewValue)) return;
|
|
|
|
|
control.RaisePropertyChanged(e.Property.Name);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-30 19:39:12 +00:00
|
|
|
|
}
|