Reputation: 2799
I use reactiveUI for watching properties of DP The code is
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
RxApp.DeferredScheduler = DispatcherScheduler.Current;
InitializeComponent();
this.WhenAny(i => i.Width, i => i.Value).Subscribe(_ => SomeMethod("Width"));
this.WhenAny(i => i.Height, i => i.Value).Subscribe(_ => SomeMethod("Height"));
}
void SomeMethod(string hello)
{
MessageBox.Show(hello);
}
}
When I resize window by height there is no messagebox But when I resize window by width there is two messageboxes When I comment any of these whenany's it works very well, but with two whenanys work improperly
I know I can watch two propeties by one whenany but I need to watch two dependency properties of differentType by two WhenAny
How can I do this?
Upvotes: 0
Views: 143
Reputation: 74654
Hm. Can you file this bug over at http://github.com/reactiveui/reactiveui/issues? In the meantime, you might have to use a shim, something like:
var changedObservable = new Subject<Unit>();
this.SizeChanged += (o,e) => changedObservable.OnNext(Unit.Default);
Upvotes: 1