0

I have simple WPF app with two textboxes and ReactiveUI. I try to lookup for dependency property of first textbox by using WhenAny

 public partial class MainWindow : Window
{
    public MainWindow()
    {
        RxApp.DeferredScheduler = DispatcherScheduler.Current;
        InitializeComponent();
        Text1.WhenAny(i => i.Text, i => i.Value).Subscribe(_ => SomeMethod());

    }

    void SomeMethod()
    {
        MessageBox.Show("Boom!");
    }

}

My Form code is

<Window x:Class="TestObservable.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"></ColumnDefinition>
        <ColumnDefinition Width="*"></ColumnDefinition>
    </Grid.ColumnDefinitions>
    <TextBox Name="Text1" Grid.Column="0"></TextBox>
    <TextBox Name="Text2" Grid.Column="1"></TextBox>

</Grid>

BUT When I change TextBox Text it doesn't show to me

What's the problem?

takayoshi
  • 2,789
  • 5
  • 36
  • 56

1 Answers1

3

Try this:

this.WhenAny(x => x.Text1.Text, x => x.Value);

If it doesn't work, I believe you're being bitten by a bug in ReactiveUI 4.1. Upgrading to 4.2 (released a few days ago) may fix it.

Ana Betts
  • 73,868
  • 16
  • 141
  • 209